From da35f71f2d8304284bf7f8a6690b342370af7408 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 27 Mar 2020 13:46:30 +0100 Subject: [PATCH] API generation --- api/api/async_search.get.js | 4 +- api/api/async_search.submit.js | 8 +- ...form.cat_transform.js => cat.transform.js} | 8 +- api/index.js | 5 +- api/requestParams.d.ts | 32 ++--- docs/reference.asciidoc | 133 +++++++++--------- index.d.ts | 12 +- 7 files changed, 98 insertions(+), 104 deletions(-) rename api/api/{transform.cat_transform.js => cat.transform.js} (90%) diff --git a/api/api/async_search.get.js b/api/api/async_search.get.js index d4b608d9f..87fa60cf9 100644 --- a/api/api/async_search.get.js +++ b/api/api/async_search.get.js @@ -12,13 +12,13 @@ function buildAsyncSearchGet (opts) { const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts const acceptedQuerystring = [ - 'wait_for_completion', + 'wait_for_completion_timeout', 'keep_alive', 'typed_keys' ] const snakeCase = { - waitForCompletion: 'wait_for_completion', + waitForCompletionTimeout: 'wait_for_completion_timeout', keepAlive: 'keep_alive', typedKeys: 'typed_keys' } diff --git a/api/api/async_search.submit.js b/api/api/async_search.submit.js index 5764184e5..8ff473d18 100644 --- a/api/api/async_search.submit.js +++ b/api/api/async_search.submit.js @@ -12,8 +12,8 @@ function buildAsyncSearchSubmit (opts) { const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts const acceptedQuerystring = [ - 'wait_for_completion', - 'clean_on_completion', + 'wait_for_completion_timeout', + 'keep_on_completion', 'keep_alive', 'batched_reduce_size', 'request_cache', @@ -58,8 +58,8 @@ function buildAsyncSearchSubmit (opts) { ] const snakeCase = { - waitForCompletion: 'wait_for_completion', - cleanOnCompletion: 'clean_on_completion', + waitForCompletionTimeout: 'wait_for_completion_timeout', + keepOnCompletion: 'keep_on_completion', keepAlive: 'keep_alive', batchedReduceSize: 'batched_reduce_size', requestCache: 'request_cache', diff --git a/api/api/transform.cat_transform.js b/api/api/cat.transform.js similarity index 90% rename from api/api/transform.cat_transform.js rename to api/api/cat.transform.js index 04d61286f..a650e49b8 100644 --- a/api/api/transform.cat_transform.js +++ b/api/api/cat.transform.js @@ -7,7 +7,7 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildTransformCatTransform (opts) { +function buildCatTransform (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts @@ -29,10 +29,10 @@ function buildTransformCatTransform (opts) { } /** - * Perform a transform.cat_transform request + * Perform a cat.transform request * https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-transforms.html */ - return function transformCatTransform (params, options, callback) { + return function catTransform (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -82,4 +82,4 @@ function buildTransformCatTransform (opts) { } } -module.exports = buildTransformCatTransform +module.exports = buildCatTransform diff --git a/api/index.js b/api/index.js index bee5b18be..726bd6c5c 100644 --- a/api/index.js +++ b/api/index.js @@ -61,7 +61,8 @@ function ESAPI (opts) { tasks: lazyLoad('cat.tasks', opts), templates: lazyLoad('cat.templates', opts), thread_pool: lazyLoad('cat.thread_pool', opts), - threadPool: lazyLoad('cat.thread_pool', opts) + threadPool: lazyLoad('cat.thread_pool', opts), + transform: lazyLoad('cat.transform', opts) }, ccr: { delete_auto_follow_pattern: lazyLoad('ccr.delete_auto_follow_pattern', opts), @@ -579,8 +580,6 @@ function ESAPI (opts) { }, termvectors: lazyLoad('termvectors', opts), transform: { - cat_transform: lazyLoad('transform.cat_transform', opts), - catTransform: lazyLoad('transform.cat_transform', opts), delete_transform: lazyLoad('transform.delete_transform', opts), deleteTransform: lazyLoad('transform.delete_transform', opts), get_transform: lazyLoad('transform.get_transform', opts), diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index b31ee6017..2fb9761a3 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -1356,7 +1356,7 @@ export interface AsyncSearchDelete extends Generic { export interface AsyncSearchGet extends Generic { id: string; - wait_for_completion?: string; + wait_for_completion_timeout?: string; keep_alive?: string; typed_keys?: boolean; } @@ -1365,8 +1365,8 @@ export interface AsyncSearchSubmit extends Generic { index?: string | string[]; _source_exclude?: string | string[]; _source_include?: string | string[]; - wait_for_completion?: string; - clean_on_completion?: boolean; + wait_for_completion_timeout?: string; + keep_on_completion?: boolean; keep_alive?: string; batched_reduce_size?: number; request_cache?: boolean; @@ -1461,6 +1461,19 @@ export interface CatMlTrainedModels extends Generic { v?: boolean; } +export interface CatTransform extends Generic { + transform_id?: string; + from?: number; + size?: number; + allow_no_match?: boolean; + format?: string; + h?: string | string[]; + help?: boolean; + s?: string | string[]; + time?: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)'; + v?: boolean; +} + export interface CcrDeleteAutoFollowPattern extends Generic { name: string; } @@ -2307,19 +2320,6 @@ export interface SqlTranslate extends Generic { export interface SslCertificates extends Generic { } -export interface TransformCatTransform extends Generic { - transform_id?: string; - from?: number; - size?: number; - allow_no_match?: boolean; - format?: string; - h?: string | string[]; - help?: boolean; - s?: string | string[]; - time?: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)'; - v?: boolean; -} - export interface TransformDeleteTransform extends Generic { transform_id: string; force?: boolean; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index b6278409b..2e2b2a53f 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -2454,7 +2454,7 @@ client.indices.createDataStream({ body: object }) ---- - +link:{ref}/data-streams.html[Documentation] + [cols=2*] |=== |`name` @@ -2538,7 +2538,7 @@ client.indices.deleteDataStream({ name: string }) ---- - +link:{ref}/data-streams.html[Documentation] + [cols=2*] |=== |`name` @@ -2881,7 +2881,7 @@ client.indices.getDataStreams({ name: string | string[] }) ---- - +link:{ref}/data-streams.html[Documentation] + [cols=2*] |=== |`name` @@ -5452,7 +5452,7 @@ link:{ref}/async-search.html[Documentation] + ---- client.asyncSearch.get({ id: string, - wait_for_completion: string, + wait_for_completion_timeout: string, keep_alive: string, typed_keys: boolean }) @@ -5463,13 +5463,11 @@ link:{ref}/async-search.html[Documentation] + |`id` |`string` - The async search ID -|`wait_for_completion` or `waitForCompletion` -|`string` - Specify the time that the request should block waiting for the final response + -_Default:_ `1s` +|`wait_for_completion_timeout` or `waitForCompletionTimeout` +|`string` - Specify the time that the request should block waiting for the final response |`keep_alive` or `keepAlive` -|`string` - Specify the time interval in which the results (partial or final) for this search will be available + -_Default:_ `5d` +|`string` - Specify the time interval in which the results (partial or final) for this search will be available |`typed_keys` or `typedKeys` |`boolean` - Specify whether aggregation and suggester names should be prefixed by their respective types in the response @@ -5482,8 +5480,8 @@ _Default:_ `5d` ---- client.asyncSearch.submit({ index: string | string[], - wait_for_completion: string, - clean_on_completion: boolean, + wait_for_completion_timeout: string, + keep_on_completion: boolean, keep_alive: string, batched_reduce_size: number, request_cache: boolean, @@ -5532,15 +5530,16 @@ link:{ref}/async-search.html[Documentation] + |`index` |`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices -|`wait_for_completion` or `waitForCompletion` +|`wait_for_completion_timeout` or `waitForCompletionTimeout` |`string` - Specify the time that the request should block waiting for the final response + _Default:_ `1s` -|`clean_on_completion` or `cleanOnCompletion` -|`boolean` - Control whether the response should not be stored in the cluster if it completed within the provided [wait_for_completion] time (default: true) +|`keep_on_completion` or `keepOnCompletion` +|`boolean` - Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: true) |`keep_alive` or `keepAlive` -|`string` - Update the time interval in which the results (partial or final) for this search will be available +|`string` - Update the time interval in which the results (partial or final) for this search will be available + +_Default:_ `5d` |`batched_reduce_size` or `batchedReduceSize` |`number` - The number of shard results that should be reduced at once on the coordinating node. This value should be used as the granularity at which progress results will be made available. + @@ -5874,6 +5873,58 @@ _Default:_ `100` |=== +=== cat.transform + +[source,ts] +---- +client.cat.transform({ + transform_id: string, + from: number, + size: number, + allow_no_match: boolean, + format: string, + h: string | string[], + help: boolean, + s: string | string[], + time: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)', + v: boolean +}) +---- +link:{ref}/cat-transforms.html[Documentation] + +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the transform for which to get stats. '_all' or '*' implies all transforms + +|`from` +|`number` - skips a number of transform configs, defaults to 0 + +|`size` +|`number` - specifies a max number of transforms to get, defaults to 100 + +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) + +|`format` +|`string` - a short version of the Accept header, e.g. json, yaml + +|`h` +|`string \| string[]` - Comma-separated list of column names to display + +|`help` +|`boolean` - Return help information + +|`s` +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by + +|`time` +|`'d (Days)' \| 'h (Hours)' \| 'm (Minutes)' \| 's (Seconds)' \| 'ms (Milliseconds)' \| 'micros (Microseconds)' \| 'nanos (Nanoseconds)'` - The unit in which to display time values + +|`v` +|`boolean` - Verbose mode. Display column headers + +|=== + === ccr.deleteAutoFollowPattern [source,ts] @@ -9200,58 +9251,6 @@ client.ssl.certificates() link:{ref}/security-api-ssl.html[Documentation] + -=== transform.catTransform - -[source,ts] ----- -client.transform.catTransform({ - transform_id: string, - from: number, - size: number, - allow_no_match: boolean, - format: string, - h: string | string[], - help: boolean, - s: string | string[], - time: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)', - v: boolean -}) ----- -link:{ref}/cat-transforms.html[Documentation] + -[cols=2*] -|=== -|`transform_id` or `transformId` -|`string` - The id of the transform for which to get stats. '_all' or '*' implies all transforms - -|`from` -|`number` - skips a number of transform configs, defaults to 0 - -|`size` -|`number` - specifies a max number of transforms to get, defaults to 100 - -|`allow_no_match` or `allowNoMatch` -|`boolean` - Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) - -|`format` -|`string` - a short version of the Accept header, e.g. json, yaml - -|`h` -|`string \| string[]` - Comma-separated list of column names to display - -|`help` -|`boolean` - Return help information - -|`s` -|`string \| string[]` - Comma-separated list of column names or column aliases to sort by - -|`time` -|`'d (Days)' \| 'h (Hours)' \| 'm (Minutes)' \| 's (Seconds)' \| 'ms (Milliseconds)' \| 'micros (Microseconds)' \| 'nanos (Nanoseconds)'` - The unit in which to display time values - -|`v` -|`boolean` - Verbose mode. Display column headers - -|=== - === transform.deleteTransform [source,ts] diff --git a/index.d.ts b/index.d.ts index 4a5053f52..0174271d2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -275,6 +275,10 @@ declare class Client extends EventEmitter { threadPool(callback: callbackFn): TransportRequestCallback threadPool(params: RequestParams.CatThreadPool, callback: callbackFn): TransportRequestCallback threadPool(params: RequestParams.CatThreadPool, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + transform(params?: RequestParams.CatTransform, options?: TransportRequestOptions): Promise> + transform(callback: callbackFn): TransportRequestCallback + transform(params: RequestParams.CatTransform, callback: callbackFn): TransportRequestCallback + transform(params: RequestParams.CatTransform, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback } ccr: { delete_auto_follow_pattern(params?: RequestParams.CcrDeleteAutoFollowPattern, options?: TransportRequestOptions): Promise> @@ -2205,14 +2209,6 @@ declare class Client extends EventEmitter { termvectors(params: RequestParams.Termvectors, callback: callbackFn): TransportRequestCallback termvectors(params: RequestParams.Termvectors, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback transform: { - cat_transform(params?: RequestParams.TransformCatTransform, options?: TransportRequestOptions): Promise> - cat_transform(callback: callbackFn): TransportRequestCallback - cat_transform(params: RequestParams.TransformCatTransform, callback: callbackFn): TransportRequestCallback - cat_transform(params: RequestParams.TransformCatTransform, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback - catTransform(params?: RequestParams.TransformCatTransform, options?: TransportRequestOptions): Promise> - catTransform(callback: callbackFn): TransportRequestCallback - catTransform(params: RequestParams.TransformCatTransform, callback: callbackFn): TransportRequestCallback - catTransform(params: RequestParams.TransformCatTransform, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback delete_transform(params?: RequestParams.TransformDeleteTransform, options?: TransportRequestOptions): Promise> delete_transform(callback: callbackFn): TransportRequestCallback delete_transform(params: RequestParams.TransformDeleteTransform, callback: callbackFn): TransportRequestCallback