|
|
@@ -6,9 +6,12 @@ import {
|
|
|
BulkResponse,
|
|
|
CatAliasesResponse,
|
|
|
CatIndicesResponse,
|
|
|
+ IndicesExistsResponse,
|
|
|
IndicesExistsAliasResponse,
|
|
|
NodesInfoResponse,
|
|
|
SearchResponse,
|
|
|
+ ValidateQueryResponse,
|
|
|
+ ClusterHealthResponse,
|
|
|
} from './elasticsearch-client-types';
|
|
|
|
|
|
type ApiResponse<T = any, C = any> = ES6ApiResponse<T, C> | ES7ApiResponse<T, C>
|
|
|
@@ -33,17 +36,26 @@ export default class ElasticsearchClient {
|
|
|
this.client instanceof ES6Client ? this.client.cat.indices(params) : this.client.cat.indices(params),
|
|
|
}
|
|
|
|
|
|
+ cluster = {
|
|
|
+ health: (params: ES6RequestParams.ClusterHealth & ES7RequestParams.ClusterHealth): Promise<ApiResponse<ClusterHealthResponse>> =>
|
|
|
+ this.client instanceof ES6Client ? this.client.cluster.health(params) : this.client.cluster.health(params),
|
|
|
+ }
|
|
|
+
|
|
|
indices = {
|
|
|
create: (params: ES6RequestParams.IndicesCreate & ES7RequestParams.IndicesCreate) =>
|
|
|
this.client instanceof ES6Client ? this.client.indices.create(params) : this.client.indices.create(params),
|
|
|
delete: (params: ES6RequestParams.IndicesDelete & ES7RequestParams.IndicesDelete) =>
|
|
|
this.client instanceof ES6Client ? this.client.indices.delete(params) : this.client.indices.delete(params),
|
|
|
+ exists: (params: ES6RequestParams.IndicesExists & ES7RequestParams.IndicesExists): Promise<ApiResponse<IndicesExistsResponse>> =>
|
|
|
+ this.client instanceof ES6Client ? this.client.indices.exists(params) : this.client.indices.exists(params),
|
|
|
existsAlias: (params: ES6RequestParams.IndicesExistsAlias & ES7RequestParams.IndicesExistsAlias): Promise<ApiResponse<IndicesExistsAliasResponse>> =>
|
|
|
this.client instanceof ES6Client ? this.client.indices.existsAlias(params) : this.client.indices.existsAlias(params),
|
|
|
putAlias: (params: ES6RequestParams.IndicesPutAlias & ES7RequestParams.IndicesPutAlias) =>
|
|
|
this.client instanceof ES6Client ? this.client.indices.putAlias(params) : this.client.indices.putAlias(params),
|
|
|
updateAliases: (params: ES6RequestParams.IndicesUpdateAliases & ES7RequestParams.IndicesUpdateAliases) =>
|
|
|
this.client instanceof ES6Client ? this.client.indices.updateAliases(params) : this.client.indices.updateAliases(params),
|
|
|
+ validateQuery: (params: ES6RequestParams.IndicesValidateQuery & ES7RequestParams.IndicesValidateQuery): Promise<ApiResponse<ValidateQueryResponse>> =>
|
|
|
+ this.client instanceof ES6Client ? this.client.indices.validateQuery(params) : this.client.indices.validateQuery(params),
|
|
|
}
|
|
|
|
|
|
nodes = {
|