From f85d5b4341296ef83a1603fc6c8af431027e31c1 Mon Sep 17 00:00:00 2001 From: Budi Irawan Date: Tue, 6 Mar 2018 22:11:36 +1100 Subject: [PATCH] Add UpdateDocumentByQueryResponse elasticsearch --- types/elasticsearch/elasticsearch-tests.ts | 24 ++++++++++++++++++++++ types/elasticsearch/index.d.ts | 23 +++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/types/elasticsearch/elasticsearch-tests.ts b/types/elasticsearch/elasticsearch-tests.ts index 10c4659998..e21f84dc48 100644 --- a/types/elasticsearch/elasticsearch-tests.ts +++ b/types/elasticsearch/elasticsearch-tests.ts @@ -266,6 +266,30 @@ client.search({ } }); +client.updateByQuery({ + index: 'myIndex', + type: 'mytype', +}, (error, response) => { + const { + took, + timed_out, + updated, + deleted, + batches, + version_conflicts, + noops, + retries, + throttled_millis, + throttled_until_millis, + total, + failures + } = response; + + const { bulk, search } = retries; + + // ... +}); + client.indices.updateAliases({ body: { actions: [ diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index c6b05da9a0..e60e8d86c3 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -89,8 +89,8 @@ export class Client { termvectors(params: TermvectorsParams, callback: (error: any, response: any) => void): void; update(params: UpdateDocumentParams): Promise; update(params: UpdateDocumentParams, callback: (error: any, response: any) => void): void; - updateByQuery(params: UpdateDocumentByQueryParams): Promise; - updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: any) => void): void; + updateByQuery(params: UpdateDocumentByQueryParams): Promise; + updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: UpdateDocumentByQueryResponse) => void): void; close(): void; } @@ -785,6 +785,25 @@ export interface UpdateDocumentByQueryParams extends GenericParams { type: NameList; } +export interface UpdateDocumentByQueryResponse { + took: number; + timed_out: boolean; + updated: number; + deleted: number; + batches: number; + version_conflicts: number; + noops: number; + retries: { + bulk: number; + search: number; + }; + throttled_millis: number; + requests_per_second: number; + throttled_until_millis: number; + total: number; + failures: any[]; +} + export interface Cat { aliases(params: CatAliasesParams, callback: (error: any, response: any) => void): void; aliases(params: CatAliasesParams): Promise;