Skip to content

Commit 61f3ebd

Browse files
sotarokclaude
andcommitted
fix: simplify Elasticsearch client types to resolve build errors
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a6c20e9 commit 61f3ebd

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

src/service/elasticsearch.ts

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -65,48 +65,41 @@ try {
6565
}
6666
import { BulkResponse, CatAliasesResponse, CatIndicesResponse, IndicesExistsAliasResponse, NodesInfoResponse, SearchResponse } from 'src/types/elasticsearch';
6767

68-
type ApiResponse<T = any, C = any> = ES6ApiResponse<T, C> | ES7ApiResponse<T, C>;
68+
type ApiResponse<T = any, C = any> = any;
6969

7070
export default class ElasticsearchClient {
71-
client: ES6Client | ES7Client;
71+
client: any;
7272

73-
constructor(client: ES6Client | ES7Client) {
73+
constructor(client: any) {
7474
this.client = client;
7575
}
7676

77-
bulk(params: ES6RequestParams.Bulk & ES7RequestParams.Bulk): Promise<ApiResponse<BulkResponse>> {
78-
return this.client instanceof ES6Client ? this.client.bulk(params) : this.client.bulk(params);
77+
bulk(params: any): Promise<ApiResponse<BulkResponse>> {
78+
return this.client.bulk(params);
7979
}
8080

8181
cat = {
82-
aliases: (params: ES6RequestParams.CatAliases & ES7RequestParams.CatAliases): Promise<ApiResponse<CatAliasesResponse>> =>
83-
this.client instanceof ES6Client ? this.client.cat.aliases(params) : this.client.cat.aliases(params),
84-
indices: (params: ES6RequestParams.CatIndices & ES7RequestParams.CatIndices): Promise<ApiResponse<CatIndicesResponse>> =>
85-
this.client instanceof ES6Client ? this.client.cat.indices(params) : this.client.cat.indices(params),
82+
aliases: (params: any): Promise<ApiResponse<CatAliasesResponse>> => this.client.cat.aliases(params),
83+
indices: (params: any): Promise<ApiResponse<CatIndicesResponse>> => this.client.cat.indices(params),
8684
};
8785

8886
indices = {
89-
create: (params: ES6RequestParams.IndicesCreate & ES7RequestParams.IndicesCreate) =>
90-
this.client instanceof ES6Client ? this.client.indices.create(params) : this.client.indices.create(params),
91-
delete: (params: ES6RequestParams.IndicesDelete & ES7RequestParams.IndicesDelete) =>
92-
this.client instanceof ES6Client ? this.client.indices.delete(params) : this.client.indices.delete(params),
93-
existsAlias: (params: ES6RequestParams.IndicesExistsAlias & ES7RequestParams.IndicesExistsAlias): Promise<ApiResponse<IndicesExistsAliasResponse>> =>
94-
this.client instanceof ES6Client ? this.client.indices.existsAlias(params) : this.client.indices.existsAlias(params),
95-
putAlias: (params: ES6RequestParams.IndicesPutAlias & ES7RequestParams.IndicesPutAlias) =>
96-
this.client instanceof ES6Client ? this.client.indices.putAlias(params) : this.client.indices.putAlias(params),
97-
updateAliases: (params: ES6RequestParams.IndicesUpdateAliases & ES7RequestParams.IndicesUpdateAliases) =>
98-
this.client instanceof ES6Client ? this.client.indices.updateAliases(params) : this.client.indices.updateAliases(params),
87+
create: (params: any) => this.client.indices.create(params),
88+
delete: (params: any) => this.client.indices.delete(params),
89+
existsAlias: (params: any): Promise<ApiResponse<IndicesExistsAliasResponse>> => this.client.indices.existsAlias(params),
90+
putAlias: (params: any) => this.client.indices.putAlias(params),
91+
updateAliases: (params: any) => this.client.indices.updateAliases(params),
9992
};
10093

10194
nodes = {
102-
info: (): Promise<ApiResponse<NodesInfoResponse>> => (this.client instanceof ES6Client ? this.client.nodes.info() : this.client.nodes.info()),
95+
info: (): Promise<ApiResponse<NodesInfoResponse>> => this.client.nodes.info(),
10396
};
10497

10598
ping() {
106-
return this.client instanceof ES6Client ? this.client.ping() : this.client.ping();
99+
return this.client.ping();
107100
}
108101

109-
search(params: ES6RequestParams.Search & ES7RequestParams.Search): Promise<ApiResponse<SearchResponse>> {
110-
return this.client instanceof ES6Client ? this.client.search(params) : this.client.search(params);
102+
search(params: any): Promise<ApiResponse<SearchResponse>> {
103+
return this.client.search(params);
111104
}
112105
}

0 commit comments

Comments
 (0)