diff --git a/api/api/cat.ml_data_frame_analytics.js b/api/api/cat.ml_data_frame_analytics.js new file mode 100644 index 000000000..002d6ceed --- /dev/null +++ b/api/api/cat.ml_data_frame_analytics.js @@ -0,0 +1,84 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildCatMlDataFrameAnalytics (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + + const acceptedQuerystring = [ + 'allow_no_match', + 'bytes', + 'format', + 'h', + 'help', + 's', + 'time', + 'v' + ] + + const snakeCase = { + allowNoMatch: 'allow_no_match' + + } + + /** + * Perform a cat.ml_data_frame_analytics request + * http://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics-stats.html + */ + return function catMlDataFrameAnalytics (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // validate headers object + if (options.headers != null && typeof options.headers !== 'object') { + const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + if ((id) != null) { + if (method == null) method = 'GET' + path = '/' + '_cat' + '/' + 'ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + } else { + if (method == null) method = 'GET' + path = '/' + '_cat' + '/' + 'ml' + '/' + 'data_frame' + '/' + 'analytics' + } + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildCatMlDataFrameAnalytics diff --git a/api/index.js b/api/index.js index 56f7cda63..b7b5c1546 100644 --- a/api/index.js +++ b/api/index.js @@ -30,6 +30,8 @@ function ESAPI (opts) { help: lazyLoad('cat.help', opts), indices: lazyLoad('cat.indices', opts), master: lazyLoad('cat.master', opts), + ml_data_frame_analytics: lazyLoad('cat.ml_data_frame_analytics', opts), + mlDataFrameAnalytics: lazyLoad('cat.ml_data_frame_analytics', opts), ml_datafeeds: lazyLoad('cat.ml_datafeeds', opts), mlDatafeeds: lazyLoad('cat.ml_datafeeds', opts), ml_jobs: lazyLoad('cat.ml_jobs', opts), diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index fc5a6f38a..12966fe59 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -1318,6 +1318,18 @@ export interface UpdateByQueryRethrottle extends Generic { export interface AutoscalingGetAutoscalingDecision extends Generic { } +export interface CatMlDataFrameAnalytics extends Generic { + id?: string; + allow_no_match?: boolean; + bytes?: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb'; + 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 CatMlDatafeeds extends Generic { datafeed_id?: string; allow_no_datafeeds?: boolean; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 02884b95c..36b7023e6 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -5307,6 +5307,54 @@ client.autoscaling.getAutoscalingDecision() link:{ref}/autoscaling-get-autoscaling-decision.html[Documentation] + +=== cat.mlDataFrameAnalytics + +[source,ts] +---- +client.cat.mlDataFrameAnalytics({ + id: string, + allow_no_match: boolean, + bytes: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb', + 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}/get-dfanalytics-stats.html[Documentation] + +[cols=2*] +|=== +|`id` +|`string` - The ID of the data frame analytics to fetch + +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no configs. (This includes `_all` string or when no configs have been specified) + +|`bytes` +|`'b' \| 'k' \| 'kb' \| 'm' \| 'mb' \| 'g' \| 'gb' \| 't' \| 'tb' \| 'p' \| 'pb'` - The unit in which to display byte values + +|`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 + +|=== + === cat.mlDatafeeds [source,ts] diff --git a/index.d.ts b/index.d.ts index 1de2bd3d4..cc9ce1756 100644 --- a/index.d.ts +++ b/index.d.ts @@ -129,6 +129,8 @@ declare class Client extends EventEmitter { help: ApiMethod indices: ApiMethod master: ApiMethod + ml_data_frame_analytics: ApiMethod + mlDataFrameAnalytics: ApiMethod ml_datafeeds: ApiMethod mlDatafeeds: ApiMethod ml_jobs: ApiMethod