API generation

This commit is contained in:
delvedor
2020-03-27 13:46:30 +01:00
parent f913f7d2d2
commit da35f71f2d
7 changed files with 98 additions and 104 deletions

View File

@ -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'
}

View File

@ -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',

View File

@ -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

View File

@ -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),

View File

@ -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<T = RequestBody> 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<T = RequestBody> 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;

View File

@ -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]

12
index.d.ts vendored
View File

@ -275,6 +275,10 @@ declare class Client extends EventEmitter {
threadPool<TResponse = ResponseBody, TContext = unknown>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
threadPool<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.CatThreadPool, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
threadPool<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.CatThreadPool, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
transform<TResponse = ResponseBody, TContext = unknown>(params?: RequestParams.CatTransform, options?: TransportRequestOptions): Promise<ApiResponse<TResponse, TContext>>
transform<TResponse = ResponseBody, TContext = unknown>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
transform<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.CatTransform, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
transform<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.CatTransform, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
}
ccr: {
delete_auto_follow_pattern<TResponse = ResponseBody, TContext = unknown>(params?: RequestParams.CcrDeleteAutoFollowPattern, options?: TransportRequestOptions): Promise<ApiResponse<TResponse, TContext>>
@ -2205,14 +2209,6 @@ declare class Client extends EventEmitter {
termvectors<TRequestBody extends RequestBody, TResponse = ResponseBody, TContext = unknown>(params: RequestParams.Termvectors<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
termvectors<TRequestBody extends RequestBody, TResponse = ResponseBody, TContext = unknown>(params: RequestParams.Termvectors<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
transform: {
cat_transform<TResponse = ResponseBody, TContext = unknown>(params?: RequestParams.TransformCatTransform, options?: TransportRequestOptions): Promise<ApiResponse<TResponse, TContext>>
cat_transform<TResponse = ResponseBody, TContext = unknown>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
cat_transform<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.TransformCatTransform, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
cat_transform<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.TransformCatTransform, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
catTransform<TResponse = ResponseBody, TContext = unknown>(params?: RequestParams.TransformCatTransform, options?: TransportRequestOptions): Promise<ApiResponse<TResponse, TContext>>
catTransform<TResponse = ResponseBody, TContext = unknown>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
catTransform<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.TransformCatTransform, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
catTransform<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.TransformCatTransform, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
delete_transform<TResponse = ResponseBody, TContext = unknown>(params?: RequestParams.TransformDeleteTransform, options?: TransportRequestOptions): Promise<ApiResponse<TResponse, TContext>>
delete_transform<TResponse = ResponseBody, TContext = unknown>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
delete_transform<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.TransformDeleteTransform, callback: callbackFn<TResponse, TContext>): TransportRequestCallback