Browse Source

params: any -> estypes

Shun Miyazawa 2 years ago
parent
commit
8debe4db32
1 changed files with 16 additions and 16 deletions
  1. 16 16
      apps/app/src/server/service/search-delegator/elasticsearch-client.ts

+ 16 - 16
apps/app/src/server/service/search-delegator/elasticsearch-client.ts

@@ -1,7 +1,7 @@
 /* eslint-disable implicit-arrow-linebreak */
 /* eslint-disable no-confusing-arrow */
 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 {
   BulkResponse,
@@ -27,46 +27,46 @@ export default class ElasticsearchClient {
     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);
   }
 
   // TODO: cat is not used in current Implementation, remove 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),
-    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),
   };
 
   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),
   };
 
   indices = {
     // 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),
     // 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),
-    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),
-    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),
     // 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),
     // 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),
     // 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),
-    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),
-    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),
   };
 
@@ -79,11 +79,11 @@ export default class ElasticsearchClient {
     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);
   }
 
-  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);
   }