|
@@ -1,7 +1,7 @@
|
|
|
/* eslint-disable implicit-arrow-linebreak */
|
|
/* eslint-disable implicit-arrow-linebreak */
|
|
|
/* eslint-disable no-confusing-arrow */
|
|
/* eslint-disable no-confusing-arrow */
|
|
|
import { Client as ES7Client, ApiResponse as ES7ApiResponse, RequestParams as ES7RequestParams } from '@elastic/elasticsearch7';
|
|
import { Client as ES7Client, ApiResponse as ES7ApiResponse, RequestParams as ES7RequestParams } from '@elastic/elasticsearch7';
|
|
|
-import { Client as ES8Client } from '@elastic/elasticsearch8';
|
|
|
|
|
|
|
+import { Client as ES8Client, estypes } from '@elastic/elasticsearch8';
|
|
|
|
|
|
|
|
import {
|
|
import {
|
|
|
BulkResponse,
|
|
BulkResponse,
|
|
@@ -27,46 +27,46 @@ export default class ElasticsearchClient {
|
|
|
this.client = client;
|
|
this.client = client;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- bulk(params: ES7RequestParams.Bulk & any): Promise<ApiResponse<BulkResponse>> {
|
|
|
|
|
|
|
+ bulk(params: ES7RequestParams.Bulk & estypes.BulkRequest): Promise<ApiResponse<BulkResponse>> {
|
|
|
return this.client instanceof ES7Client ? this.client.bulk(params) : this.client.bulk(params);
|
|
return this.client instanceof ES7Client ? this.client.bulk(params) : this.client.bulk(params);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// TODO: cat is not used in current Implementation, remove cat?
|
|
// TODO: cat is not used in current Implementation, remove cat?
|
|
|
cat = {
|
|
cat = {
|
|
|
- aliases: (params: ES7RequestParams.CatAliases & any): Promise<ApiResponse<CatAliasesResponse>> =>
|
|
|
|
|
|
|
+ aliases: (params: ES7RequestParams.CatAliases & estypes.CatAliasesRequest): Promise<ApiResponse<CatAliasesResponse>> =>
|
|
|
this.client instanceof ES7Client ? this.client.cat.aliases(params) : this.client.cat.aliases(params),
|
|
this.client instanceof ES7Client ? this.client.cat.aliases(params) : this.client.cat.aliases(params),
|
|
|
- indices: (params: ES7RequestParams.CatIndices & any): Promise<ApiResponse<CatIndicesResponse>> =>
|
|
|
|
|
|
|
+ indices: (params: ES7RequestParams.CatIndices & estypes.CatIndicesRequest): Promise<ApiResponse<CatIndicesResponse>> =>
|
|
|
this.client instanceof ES7Client ? this.client.cat.indices(params) : this.client.cat.indices(params),
|
|
this.client instanceof ES7Client ? this.client.cat.indices(params) : this.client.cat.indices(params),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
cluster = {
|
|
cluster = {
|
|
|
- health: (params: ES7RequestParams.ClusterHealth & any): Promise<ApiResponse<ClusterHealthResponse>> =>
|
|
|
|
|
|
|
+ health: (params: ES7RequestParams.ClusterHealth & estypes.ClusterHealthRequest): Promise<ApiResponse<ClusterHealthResponse>> =>
|
|
|
this.client instanceof ES7Client ? this.client.cluster.health(params) : this.client.cluster.health(params),
|
|
this.client instanceof ES7Client ? this.client.cluster.health(params) : this.client.cluster.health(params),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
indices = {
|
|
indices = {
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
|
- create: (params: ES7RequestParams.IndicesCreate & any) =>
|
|
|
|
|
|
|
+ create: (params: ES7RequestParams.IndicesCreate & estypes.IndicesCreateRequest) =>
|
|
|
this.client instanceof ES7Client ? this.client.indices.create(params) : this.client.indices.create(params),
|
|
this.client instanceof ES7Client ? this.client.indices.create(params) : this.client.indices.create(params),
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
|
- delete: (params: ES7RequestParams.IndicesDelete & any) =>
|
|
|
|
|
|
|
+ delete: (params: ES7RequestParams.IndicesDelete & estypes.IndicesDeleteRequest) =>
|
|
|
this.client instanceof ES7Client ? this.client.indices.delete(params) : this.client.indices.delete(params),
|
|
this.client instanceof ES7Client ? this.client.indices.delete(params) : this.client.indices.delete(params),
|
|
|
- exists: (params: ES7RequestParams.IndicesExists & any): Promise<ApiResponse<IndicesExistsResponse>> =>
|
|
|
|
|
|
|
+ exists: (params: ES7RequestParams.IndicesExists & estypes.IndicesDeleteRequest): Promise<ApiResponse<IndicesExistsResponse>> =>
|
|
|
this.client instanceof ES7Client ? this.client.indices.exists(params) : this.client.indices.exists(params),
|
|
this.client instanceof ES7Client ? this.client.indices.exists(params) : this.client.indices.exists(params),
|
|
|
- existsAlias: (params: ES7RequestParams.IndicesExistsAlias & any): Promise<ApiResponse<IndicesExistsAliasResponse>> =>
|
|
|
|
|
|
|
+ existsAlias: (params: ES7RequestParams.IndicesExistsAlias & estypes.IndicesExistsAliasRequest): Promise<ApiResponse<IndicesExistsAliasResponse>> =>
|
|
|
this.client instanceof ES7Client ? this.client.indices.existsAlias(params) : this.client.indices.existsAlias(params),
|
|
this.client instanceof ES7Client ? this.client.indices.existsAlias(params) : this.client.indices.existsAlias(params),
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
|
- putAlias: (params: ES7RequestParams.IndicesPutAlias & any) =>
|
|
|
|
|
|
|
+ putAlias: (params: ES7RequestParams.IndicesPutAlias & estypes.IndicesPutAliasRequest) =>
|
|
|
this.client instanceof ES7Client ? this.client.indices.putAlias(params) : this.client.indices.putAlias(params),
|
|
this.client instanceof ES7Client ? this.client.indices.putAlias(params) : this.client.indices.putAlias(params),
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
|
- getAlias: (params: ES7RequestParams.IndicesGetAlias & any) =>
|
|
|
|
|
|
|
+ getAlias: (params: ES7RequestParams.IndicesGetAlias & estypes.IndicesGetAliasRequest) =>
|
|
|
this.client instanceof ES7Client ? this.client.indices.getAlias(params) : this.client.indices.getAlias(params),
|
|
this.client instanceof ES7Client ? this.client.indices.getAlias(params) : this.client.indices.getAlias(params),
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
|
- updateAliases: (params: ES7RequestParams.IndicesUpdateAliases & any) =>
|
|
|
|
|
|
|
+ updateAliases: (params: ES7RequestParams.IndicesUpdateAliases & estypes.IndicesUpdateAliasesRequest) =>
|
|
|
this.client instanceof ES7Client ? this.client.indices.updateAliases(params) : this.client.indices.updateAliases(params),
|
|
this.client instanceof ES7Client ? this.client.indices.updateAliases(params) : this.client.indices.updateAliases(params),
|
|
|
- validateQuery: (params: ES7RequestParams.IndicesValidateQuery & any): Promise<ApiResponse<ValidateQueryResponse>> =>
|
|
|
|
|
|
|
+ validateQuery: (params: ES7RequestParams.IndicesValidateQuery & estypes.IndicesUpdateAliasesRequest): Promise<ApiResponse<ValidateQueryResponse>> =>
|
|
|
this.client instanceof ES7Client ? this.client.indices.validateQuery(params) : this.client.indices.validateQuery(params),
|
|
this.client instanceof ES7Client ? this.client.indices.validateQuery(params) : this.client.indices.validateQuery(params),
|
|
|
- stats: (params: ES7RequestParams.IndicesStats & any): Promise<ApiResponse<IndicesStatsResponse>> =>
|
|
|
|
|
|
|
+ stats: (params: ES7RequestParams.IndicesStats & estypes.IndicesStatsRequest): Promise<ApiResponse<IndicesStatsResponse>> =>
|
|
|
this.client instanceof ES7Client ? this.client.indices.stats(params) : this.client.indices.stats(params),
|
|
this.client instanceof ES7Client ? this.client.indices.stats(params) : this.client.indices.stats(params),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -79,11 +79,11 @@ export default class ElasticsearchClient {
|
|
|
return this.client instanceof ES7Client ? this.client.ping() : this.client.ping();
|
|
return this.client instanceof ES7Client ? this.client.ping() : this.client.ping();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- reindex(params: ES7RequestParams.Reindex & any): Promise<ApiResponse<ReindexResponse>> {
|
|
|
|
|
|
|
+ reindex(params: ES7RequestParams.Reindex & estypes.ReindexRequest): Promise<ApiResponse<ReindexResponse>> {
|
|
|
return this.client instanceof ES7Client ? this.client.reindex(params) : this.client.reindex(params);
|
|
return this.client instanceof ES7Client ? this.client.reindex(params) : this.client.reindex(params);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- search(params: ES7RequestParams.Search & any): Promise<ApiResponse<SearchResponse>> {
|
|
|
|
|
|
|
+ search(params: ES7RequestParams.Search & estypes.SearchRequest): Promise<ApiResponse<SearchResponse>> {
|
|
|
return this.client instanceof ES7Client ? this.client.search(params) : this.client.search(params);
|
|
return this.client instanceof ES7Client ? this.client.search(params) : this.client.search(params);
|
|
|
}
|
|
}
|
|
|
|
|
|