From fb73b4b08d35103474465808307129ebd75d49c7 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 28 Mar 2019 09:05:00 +0100 Subject: [PATCH] Master should use the latest version of ES (#780) The `master` branch should work with the latest snapshot of Elasticsearch. - Use `8.0.0-SNAPSHOT` - Code generation - Updated scripts and CI conf --- .ci/docker-compose.yml | 4 +- .ci/test-matrix.yml | 2 +- .travis.yml | 4 +- api/api/cat.indices.js | 3 + api/api/ccr.follow_stats.js | 6 + ...tion.upgrade.js => ccr.forget_follower.js} | 22 +- api/api/cluster.health.js | 3 + .../data_frame.delete_data_frame_transform.js | 126 +++ .../data_frame.get_data_frame_transform.js | 129 +++ ...ta_frame.get_data_frame_transform_stats.js | 122 +++ ...data_frame.preview_data_frame_transform.js | 122 +++ .../data_frame.put_data_frame_transform.js | 127 +++ .../data_frame.start_data_frame_transform.js | 127 +++ .../data_frame.stop_data_frame_transform.js | 130 +++ ...pack.graph.explore.js => graph.explore.js} | 8 +- api/api/ilm.explain_lifecycle.js | 3 +- api/api/indices.close.js | 3 + api/api/indices.shrink.js | 3 - api/api/indices.split.js | 3 - api/api/indices.stats.js | 9 + ...ck.license.delete.js => license.delete.js} | 8 +- .../{xpack.license.get.js => license.get.js} | 8 +- ..._status.js => license.get_basic_status.js} | 8 +- ..._status.js => license.get_trial_status.js} | 8 +- ...{xpack.license.post.js => license.post.js} | 8 +- ...t_basic.js => license.post_start_basic.js} | 8 +- ...t_trial.js => license.post_start_trial.js} | 8 +- ...recations.js => migration.deprecations.js} | 8 +- api/api/ml.get_calendars.js | 9 +- api/api/reindex.js | 2 + ...lup.delete_job.js => rollup.delete_job.js} | 8 +- ....rollup.get_jobs.js => rollup.get_jobs.js} | 8 +- ...llup_caps.js => rollup.get_rollup_caps.js} | 8 +- ...aps.js => rollup.get_rollup_index_caps.js} | 8 +- ...ck.rollup.put_job.js => rollup.put_job.js} | 8 +- ...llup_search.js => rollup.rollup_search.js} | 10 +- ...ollup.start_job.js => rollup.start_job.js} | 8 +- ....rollup.stop_job.js => rollup.stop_job.js} | 8 +- api/api/scripts_painless_context.js | 122 +++ api/api/security.disable_user.js | 4 + api/api/security.enable_user.js | 4 + api/api/security.get_privileges.js | 4 +- api/api/security.put_role_mapping.js | 2 +- ...ql.clear_cursor.js => sql.clear_cursor.js} | 8 +- api/api/{xpack.sql.query.js => sql.query.js} | 8 +- ...pack.sql.translate.js => sql.translate.js} | 8 +- ...cher.ack_watch.js => watcher.ack_watch.js} | 8 +- ...ate_watch.js => watcher.activate_watch.js} | 8 +- ...e_watch.js => watcher.deactivate_watch.js} | 8 +- ...elete_watch.js => watcher.delete_watch.js} | 8 +- ...cute_watch.js => watcher.execute_watch.js} | 8 +- ...cher.get_watch.js => watcher.get_watch.js} | 8 +- ...cher.put_watch.js => watcher.put_watch.js} | 8 +- ...pack.watcher.start.js => watcher.start.js} | 8 +- ...pack.watcher.stats.js => watcher.stats.js} | 12 +- ...{xpack.watcher.stop.js => watcher.stop.js} | 8 +- api/api/xpack.migration.get_assistance.js | 127 --- api/index.js | 165 ++-- api/requestParams.d.ts | 274 +++--- docs/reference.asciidoc | 822 ++++++++++-------- index.d.ts | 163 ++-- scripts/es-docker-platinum.sh | 7 +- scripts/es-docker.sh | 7 +- scripts/run.js | 6 +- scripts/utils/clone-es.js | 17 +- test/integration/helper.js | 2 + test/integration/index.js | 8 +- test/integration/test-runner.js | 6 +- 68 files changed, 2044 insertions(+), 901 deletions(-) rename api/api/{xpack.migration.upgrade.js => ccr.forget_follower.js} (78%) create mode 100644 api/api/data_frame.delete_data_frame_transform.js create mode 100644 api/api/data_frame.get_data_frame_transform.js create mode 100644 api/api/data_frame.get_data_frame_transform_stats.js create mode 100644 api/api/data_frame.preview_data_frame_transform.js create mode 100644 api/api/data_frame.put_data_frame_transform.js create mode 100644 api/api/data_frame.start_data_frame_transform.js create mode 100644 api/api/data_frame.stop_data_frame_transform.js rename api/api/{xpack.graph.explore.js => graph.explore.js} (93%) rename api/api/{xpack.license.delete.js => license.delete.js} (92%) rename api/api/{xpack.license.get.js => license.get.js} (92%) rename api/api/{xpack.license.get_basic_status.js => license.get_basic_status.js} (91%) rename api/api/{xpack.license.get_trial_status.js => license.get_trial_status.js} (91%) rename api/api/{xpack.license.post.js => license.post.js} (92%) rename api/api/{xpack.license.post_start_basic.js => license.post_start_basic.js} (91%) rename api/api/{xpack.license.post_start_trial.js => license.post_start_trial.js} (91%) rename api/api/{xpack.migration.deprecations.js => migration.deprecations.js} (91%) rename api/api/{xpack.rollup.delete_job.js => rollup.delete_job.js} (94%) rename api/api/{xpack.rollup.get_jobs.js => rollup.get_jobs.js} (94%) rename api/api/{xpack.rollup.get_rollup_caps.js => rollup.get_rollup_caps.js} (93%) rename api/api/{xpack.rollup.get_rollup_index_caps.js => rollup.get_rollup_index_caps.js} (93%) rename api/api/{xpack.rollup.put_job.js => rollup.put_job.js} (94%) rename api/api/{xpack.rollup.rollup_search.js => rollup.rollup_search.js} (92%) rename api/api/{xpack.rollup.start_job.js => rollup.start_job.js} (94%) rename api/api/{xpack.rollup.stop_job.js => rollup.stop_job.js} (94%) create mode 100644 api/api/scripts_painless_context.js rename api/api/{xpack.sql.clear_cursor.js => sql.clear_cursor.js} (93%) rename api/api/{xpack.sql.query.js => sql.query.js} (94%) rename api/api/{xpack.sql.translate.js => sql.translate.js} (93%) rename api/api/{xpack.watcher.ack_watch.js => watcher.ack_watch.js} (93%) rename api/api/{xpack.watcher.activate_watch.js => watcher.activate_watch.js} (91%) rename api/api/{xpack.watcher.deactivate_watch.js => watcher.deactivate_watch.js} (91%) rename api/api/{xpack.watcher.delete_watch.js => watcher.delete_watch.js} (91%) rename api/api/{xpack.watcher.execute_watch.js => watcher.execute_watch.js} (91%) rename api/api/{xpack.watcher.get_watch.js => watcher.get_watch.js} (92%) rename api/api/{xpack.watcher.put_watch.js => watcher.put_watch.js} (92%) rename api/api/{xpack.watcher.start.js => watcher.start.js} (91%) rename api/api/{xpack.watcher.stats.js => watcher.stats.js} (89%) rename api/api/{xpack.watcher.stop.js => watcher.stop.js} (92%) delete mode 100644 api/api/xpack.migration.get_assistance.js diff --git a/.ci/docker-compose.yml b/.ci/docker-compose.yml index fe46d5733..cd8df3ad0 100644 --- a/.ci/docker-compose.yml +++ b/.ci/docker-compose.yml @@ -22,7 +22,7 @@ services: - elasticsearch-oss elasticsearch-oss: - image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-7.0.0-beta1} + image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-8.0.0-SNAPSHOT} volumes: - esvol:/tmp networks: @@ -58,7 +58,7 @@ services: command: ["npm", "run", "test:integration"] elasticsearch-platinum: - image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-7.0.0-beta1} + image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-8.0.0-SNAPSHOT} ports: - "9200:9200" networks: diff --git a/.ci/test-matrix.yml b/.ci/test-matrix.yml index 84d69d9e0..8577d7c32 100644 --- a/.ci/test-matrix.yml +++ b/.ci/test-matrix.yml @@ -1,6 +1,6 @@ --- ELASTICSEARCH_VERSION: -- 7.0.0-beta1 +- 8.0.0-SNAPSHOT NODE_JS_VERSION: - 11 diff --git a/.travis.yml b/.travis.yml index 3eb76648b..869b3c57d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,11 +11,11 @@ node_js: env: global: - - ELASTICSEARCH_VERSION=7.0.0-beta1 + - ELASTICSEARCH_VERSION=8.0.0-SNAPSHOT - QUIET=true before_install: - - wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz + - wget https://snapshots.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz - tar -xzf elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz - ./elasticsearch-${ELASTICSEARCH_VERSION}/bin/elasticsearch -Enode.attr.testattr=test -Epath.repo=/tmp -Erepositories.url.allowed_urls='http://snapshot.*' &> /dev/null & diff --git a/api/api/cat.indices.js b/api/api/cat.indices.js index aff657648..f3469eb26 100644 --- a/api/api/cat.indices.js +++ b/api/api/cat.indices.js @@ -39,6 +39,7 @@ function buildCatIndices (opts) { * @param {boolean} pri - Set to true to return stats only for primary shards * @param {list} s - Comma-separated list of column names or column aliases to sort by * @param {boolean} v - Verbose mode. Display column headers + * @param {boolean} include_unloaded_segments - If set to true segment stats will include stats for segments that are not currently loaded into memory */ const acceptedQuerystring = [ @@ -52,6 +53,7 @@ function buildCatIndices (opts) { 'pri', 's', 'v', + 'include_unloaded_segments', 'pretty', 'human', 'error_trace', @@ -61,6 +63,7 @@ function buildCatIndices (opts) { const snakeCase = { masterTimeout: 'master_timeout', + includeUnloadedSegments: 'include_unloaded_segments', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/ccr.follow_stats.js b/api/api/ccr.follow_stats.js index 5c3806181..5d455b480 100644 --- a/api/api/ccr.follow_stats.js +++ b/api/api/ccr.follow_stats.js @@ -51,6 +51,12 @@ function buildCcrFollowStats (opts) { options = {} } + // check required parameters + if (params['index'] == null) { + const err = new ConfigurationError('Missing required parameter: index') + return handleError(err, callback) + } + // 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}`) diff --git a/api/api/xpack.migration.upgrade.js b/api/api/ccr.forget_follower.js similarity index 78% rename from api/api/xpack.migration.upgrade.js rename to api/api/ccr.forget_follower.js index e1663d3e9..1e2504cee 100644 --- a/api/api/xpack.migration.upgrade.js +++ b/api/api/ccr.forget_follower.js @@ -22,25 +22,25 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackMigrationUpgrade (opts) { +function buildCcrForgetFollower (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.migration.upgrade](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html) request + * Perform a [ccr.forget_follower](http://www.elastic.co/guide/en/elasticsearch/reference/current) request * - * @param {string} index - The name of the index - * @param {boolean} wait_for_completion - Should the request block until the upgrade operation is completed + * @param {string} index - the name of the leader index for which specified follower retention leases should be removed + * @param {object} body - the name and UUID of the follower index, the name of the cluster containing the follower index, and the alias from the perspective of that cluster for the remote cluster containing the leader index */ const acceptedQuerystring = [ - 'wait_for_completion' + ] const snakeCase = { - waitForCompletion: 'wait_for_completion' + } - return function xpackMigrationUpgrade (params, options, callback) { + return function ccrForgetFollower (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -57,6 +57,10 @@ function buildXpackMigrationUpgrade (opts) { const err = new ConfigurationError('Missing required parameter: index') return handleError(err, callback) } + if (params['body'] == null) { + const err = new ConfigurationError('Missing required parameter: body') + return handleError(err, callback) + } // validate headers object if (options.headers != null && typeof options.headers !== 'object') { @@ -79,7 +83,7 @@ function buildXpackMigrationUpgrade (opts) { var path = '' - path = '/' + '_migration' + '/' + 'upgrade' + '/' + encodeURIComponent(index) + path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'forget_follower' // build request object const request = { @@ -120,4 +124,4 @@ function buildXpackMigrationUpgrade (opts) { } } -module.exports = buildXpackMigrationUpgrade +module.exports = buildCcrForgetFollower diff --git a/api/api/cluster.health.js b/api/api/cluster.health.js index 327cbbaba..0127efecb 100644 --- a/api/api/cluster.health.js +++ b/api/api/cluster.health.js @@ -29,6 +29,7 @@ function buildClusterHealth (opts) { * Perform a [cluster.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html) request * * @param {list} index - Limit the information returned to a specific index + * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. * @param {enum} level - Specify the level of detail for returned information * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) * @param {time} master_timeout - Explicit operation timeout for connection to master node @@ -42,6 +43,7 @@ function buildClusterHealth (opts) { */ const acceptedQuerystring = [ + 'expand_wildcards', 'level', 'local', 'master_timeout', @@ -60,6 +62,7 @@ function buildClusterHealth (opts) { ] const snakeCase = { + expandWildcards: 'expand_wildcards', masterTimeout: 'master_timeout', waitForActiveShards: 'wait_for_active_shards', waitForNodes: 'wait_for_nodes', diff --git a/api/api/data_frame.delete_data_frame_transform.js b/api/api/data_frame.delete_data_frame_transform.js new file mode 100644 index 000000000..6d4656451 --- /dev/null +++ b/api/api/data_frame.delete_data_frame_transform.js @@ -0,0 +1,126 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFrameDeleteDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.delete_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-data-frame-transform.html) request + * + * @param {string} transform_id - The id of the transform to delete + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function dataFrameDeleteDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['transform_id'] == null && params['transformId'] == null) { + const err = new ConfigurationError('Missing required parameter: transform_id or transformId') + return handleError(err, callback) + } + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // 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 = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'DELETE' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + + // build request object + const request = { + method, + path, + body: '', + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFrameDeleteDataFrameTransform diff --git a/api/api/data_frame.get_data_frame_transform.js b/api/api/data_frame.get_data_frame_transform.js new file mode 100644 index 000000000..a54947560 --- /dev/null +++ b/api/api/data_frame.get_data_frame_transform.js @@ -0,0 +1,129 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFrameGetDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.get_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform.html) request + * + * @param {string} transform_id - The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms + * @param {int} from - skips a number of transform configs, defaults to 0 + * @param {int} size - specifies a max number of transforms to get, defaults to 100 + */ + + const acceptedQuerystring = [ + 'from', + 'size' + ] + + const snakeCase = { + + } + + return function dataFrameGetDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // 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 = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'GET' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + if ((transform_id || transformId) != null) { + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + } else { + path = '/' + '_data_frame' + '/' + 'transforms' + } + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFrameGetDataFrameTransform diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js new file mode 100644 index 000000000..1eec92cea --- /dev/null +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -0,0 +1,122 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFrameGetDataFrameTransformStats (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.get_data_frame_transform_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform-stats.html) request + * + * @param {string} transform_id - The id of the transform for which to get stats. '_all' or '*' implies all transforms + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function dataFrameGetDataFrameTransformStats (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // 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 = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'GET' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_stats' + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFrameGetDataFrameTransformStats diff --git a/api/api/data_frame.preview_data_frame_transform.js b/api/api/data_frame.preview_data_frame_transform.js new file mode 100644 index 000000000..761c8ad2f --- /dev/null +++ b/api/api/data_frame.preview_data_frame_transform.js @@ -0,0 +1,122 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFramePreviewDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.preview_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-data-frame-transform.html) request + * + * @param {object} body - The definition for the data_frame transform to preview + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function dataFramePreviewDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['body'] == null) { + const err = new ConfigurationError('Missing required parameter: body') + return handleError(err, callback) + } + + // 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 = null + var { method, body } = params + var querystring = semicopy(params, ['method', 'body']) + + if (method == null) { + method = 'POST' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + '_preview' + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFramePreviewDataFrameTransform diff --git a/api/api/data_frame.put_data_frame_transform.js b/api/api/data_frame.put_data_frame_transform.js new file mode 100644 index 000000000..a7e29105b --- /dev/null +++ b/api/api/data_frame.put_data_frame_transform.js @@ -0,0 +1,127 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFramePutDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.put_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-data-frame-transform.html) request + * + * @param {string} transform_id - The id of the new transform. + * @param {object} body - The data frame transform definition + */ + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + return function dataFramePutDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['transform_id'] == null && params['transformId'] == null) { + const err = new ConfigurationError('Missing required parameter: transform_id or transformId') + return handleError(err, callback) + } + if (params['body'] == null) { + const err = new ConfigurationError('Missing required parameter: body') + return handleError(err, callback) + } + + // 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 = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'PUT' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFramePutDataFrameTransform diff --git a/api/api/data_frame.start_data_frame_transform.js b/api/api/data_frame.start_data_frame_transform.js new file mode 100644 index 000000000..b75264fda --- /dev/null +++ b/api/api/data_frame.start_data_frame_transform.js @@ -0,0 +1,127 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFrameStartDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.start_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/start-data-frame-transform.html) request + * + * @param {string} transform_id - The id of the transform to start + * @param {time} timeout - Controls the time to wait for the transform to start + */ + + const acceptedQuerystring = [ + 'timeout' + ] + + const snakeCase = { + + } + + return function dataFrameStartDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['transform_id'] == null && params['transformId'] == null) { + const err = new ConfigurationError('Missing required parameter: transform_id or transformId') + return handleError(err, callback) + } + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // 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 = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'POST' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_start' + + // build request object + const request = { + method, + path, + body: '', + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFrameStartDataFrameTransform diff --git a/api/api/data_frame.stop_data_frame_transform.js b/api/api/data_frame.stop_data_frame_transform.js new file mode 100644 index 000000000..2ae878753 --- /dev/null +++ b/api/api/data_frame.stop_data_frame_transform.js @@ -0,0 +1,130 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildDataFrameStopDataFrameTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [data_frame.stop_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-data-frame-transform.html) request + * + * @param {string} transform_id - The id of the transform to stop + * @param {boolean} wait_for_completion - Whether to wait for the transform to fully stop before returning or not. Default to false + * @param {time} timeout - Controls the time to wait until the transform has stopped. Default to 30 seconds + */ + + const acceptedQuerystring = [ + 'wait_for_completion', + 'timeout' + ] + + const snakeCase = { + waitForCompletion: 'wait_for_completion' + + } + + return function dataFrameStopDataFrameTransform (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['transform_id'] == null && params['transformId'] == null) { + const err = new ConfigurationError('Missing required parameter: transform_id or transformId') + return handleError(err, callback) + } + if (params.body != null) { + const err = new ConfigurationError('This API does not require a body') + return handleError(err, callback) + } + + // 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 = null + var { method, body, transformId, transform_id } = params + var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + + if (method == null) { + method = 'POST' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_stop' + + // build request object + const request = { + method, + path, + body: '', + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildDataFrameStopDataFrameTransform diff --git a/api/api/xpack.graph.explore.js b/api/api/graph.explore.js similarity index 93% rename from api/api/xpack.graph.explore.js rename to api/api/graph.explore.js index 1217aa335..19e601a64 100644 --- a/api/api/xpack.graph.explore.js +++ b/api/api/graph.explore.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackGraphExplore (opts) { +function buildGraphExplore (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request + * Perform a [graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types @@ -44,7 +44,7 @@ function buildXpackGraphExplore (opts) { } - return function xpackGraphExplore (params, options, callback) { + return function graphExplore (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -128,4 +128,4 @@ function buildXpackGraphExplore (opts) { } } -module.exports = buildXpackGraphExplore +module.exports = buildGraphExplore diff --git a/api/api/ilm.explain_lifecycle.js b/api/api/ilm.explain_lifecycle.js index d9a0e2e70..e5638c16d 100644 --- a/api/api/ilm.explain_lifecycle.js +++ b/api/api/ilm.explain_lifecycle.js @@ -29,11 +29,10 @@ function buildIlmExplainLifecycle (opts) { * Perform a [ilm.explain_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) request * * @param {string} index - The name of the index to explain - * @param {boolean} human - Return data such as dates in a human readable format */ const acceptedQuerystring = [ - 'human' + ] const snakeCase = { diff --git a/api/api/indices.close.js b/api/api/indices.close.js index 023bc3507..a19790e32 100644 --- a/api/api/indices.close.js +++ b/api/api/indices.close.js @@ -34,6 +34,7 @@ function buildIndicesClose (opts) { * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {string} wait_for_active_shards - Sets the number of active shards to wait for before the operation returns. */ const acceptedQuerystring = [ @@ -42,6 +43,7 @@ function buildIndicesClose (opts) { 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', + 'wait_for_active_shards', 'pretty', 'human', 'error_trace', @@ -54,6 +56,7 @@ function buildIndicesClose (opts) { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', + waitForActiveShards: 'wait_for_active_shards', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/indices.shrink.js b/api/api/indices.shrink.js index e8dcbe934..9316b53a8 100644 --- a/api/api/indices.shrink.js +++ b/api/api/indices.shrink.js @@ -30,7 +30,6 @@ function buildIndicesShrink (opts) { * * @param {string} index - The name of the source index to shrink * @param {string} target - The name of the target index to shrink into - * @param {boolean} copy_settings - whether or not to copy settings from the source index (defaults to false) * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master * @param {string} wait_for_active_shards - Set the number of active shards to wait for on the shrunken index before the operation returns. @@ -38,7 +37,6 @@ function buildIndicesShrink (opts) { */ const acceptedQuerystring = [ - 'copy_settings', 'timeout', 'master_timeout', 'wait_for_active_shards', @@ -50,7 +48,6 @@ function buildIndicesShrink (opts) { ] const snakeCase = { - copySettings: 'copy_settings', masterTimeout: 'master_timeout', waitForActiveShards: 'wait_for_active_shards', errorTrace: 'error_trace', diff --git a/api/api/indices.split.js b/api/api/indices.split.js index fbb062d1f..1dad6769d 100644 --- a/api/api/indices.split.js +++ b/api/api/indices.split.js @@ -30,7 +30,6 @@ function buildIndicesSplit (opts) { * * @param {string} index - The name of the source index to split * @param {string} target - The name of the target index to split into - * @param {boolean} copy_settings - whether or not to copy settings from the source index (defaults to false) * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master * @param {string} wait_for_active_shards - Set the number of active shards to wait for on the shrunken index before the operation returns. @@ -38,7 +37,6 @@ function buildIndicesSplit (opts) { */ const acceptedQuerystring = [ - 'copy_settings', 'timeout', 'master_timeout', 'wait_for_active_shards', @@ -50,7 +48,6 @@ function buildIndicesSplit (opts) { ] const snakeCase = { - copySettings: 'copy_settings', masterTimeout: 'master_timeout', waitForActiveShards: 'wait_for_active_shards', errorTrace: 'error_trace', diff --git a/api/api/indices.stats.js b/api/api/indices.stats.js index e4b811ea5..d630947f9 100644 --- a/api/api/indices.stats.js +++ b/api/api/indices.stats.js @@ -37,6 +37,9 @@ function buildIndicesStats (opts) { * @param {enum} level - Return stats aggregated at cluster, index or shard level * @param {list} types - A comma-separated list of document types for the `indexing` index metric * @param {boolean} include_segment_file_sizes - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) + * @param {boolean} include_unloaded_segments - If set to true segment stats will include stats for segments that are not currently loaded into memory + * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {boolean} forbid_closed_indices - If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices */ const acceptedQuerystring = [ @@ -47,6 +50,9 @@ function buildIndicesStats (opts) { 'level', 'types', 'include_segment_file_sizes', + 'include_unloaded_segments', + 'expand_wildcards', + 'forbid_closed_indices', 'pretty', 'human', 'error_trace', @@ -58,6 +64,9 @@ function buildIndicesStats (opts) { completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', + includeUnloadedSegments: 'include_unloaded_segments', + expandWildcards: 'expand_wildcards', + forbidClosedIndices: 'forbid_closed_indices', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/xpack.license.delete.js b/api/api/license.delete.js similarity index 92% rename from api/api/xpack.license.delete.js rename to api/api/license.delete.js index ca14c02bd..520058967 100644 --- a/api/api/xpack.license.delete.js +++ b/api/api/license.delete.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicenseDelete (opts) { +function buildLicenseDelete (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.delete](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.delete](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * */ @@ -38,7 +38,7 @@ function buildXpackLicenseDelete (opts) { } - return function xpackLicenseDelete (params, options, callback) { + return function licenseDelete (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -118,4 +118,4 @@ function buildXpackLicenseDelete (opts) { } } -module.exports = buildXpackLicenseDelete +module.exports = buildLicenseDelete diff --git a/api/api/xpack.license.get.js b/api/api/license.get.js similarity index 92% rename from api/api/xpack.license.get.js rename to api/api/license.get.js index c189b2b13..613d0e827 100644 --- a/api/api/xpack.license.get.js +++ b/api/api/license.get.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicenseGet (opts) { +function buildLicenseGet (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.get](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.get](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) */ @@ -39,7 +39,7 @@ function buildXpackLicenseGet (opts) { } - return function xpackLicenseGet (params, options, callback) { + return function licenseGet (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackLicenseGet (opts) { } } -module.exports = buildXpackLicenseGet +module.exports = buildLicenseGet diff --git a/api/api/xpack.license.get_basic_status.js b/api/api/license.get_basic_status.js similarity index 91% rename from api/api/xpack.license.get_basic_status.js rename to api/api/license.get_basic_status.js index a3f9cd80a..911e60a27 100644 --- a/api/api/xpack.license.get_basic_status.js +++ b/api/api/license.get_basic_status.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicenseGetBasicStatus (opts) { +function buildLicenseGetBasicStatus (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.get_basic_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.get_basic_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * */ @@ -38,7 +38,7 @@ function buildXpackLicenseGetBasicStatus (opts) { } - return function xpackLicenseGetBasicStatus (params, options, callback) { + return function licenseGetBasicStatus (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -118,4 +118,4 @@ function buildXpackLicenseGetBasicStatus (opts) { } } -module.exports = buildXpackLicenseGetBasicStatus +module.exports = buildLicenseGetBasicStatus diff --git a/api/api/xpack.license.get_trial_status.js b/api/api/license.get_trial_status.js similarity index 91% rename from api/api/xpack.license.get_trial_status.js rename to api/api/license.get_trial_status.js index 34487dd5c..51d570fa2 100644 --- a/api/api/xpack.license.get_trial_status.js +++ b/api/api/license.get_trial_status.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicenseGetTrialStatus (opts) { +function buildLicenseGetTrialStatus (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.get_trial_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.get_trial_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * */ @@ -38,7 +38,7 @@ function buildXpackLicenseGetTrialStatus (opts) { } - return function xpackLicenseGetTrialStatus (params, options, callback) { + return function licenseGetTrialStatus (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -118,4 +118,4 @@ function buildXpackLicenseGetTrialStatus (opts) { } } -module.exports = buildXpackLicenseGetTrialStatus +module.exports = buildLicenseGetTrialStatus diff --git a/api/api/xpack.license.post.js b/api/api/license.post.js similarity index 92% rename from api/api/xpack.license.post.js rename to api/api/license.post.js index f0f81c6c4..fd238e700 100644 --- a/api/api/xpack.license.post.js +++ b/api/api/license.post.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicensePost (opts) { +function buildLicensePost (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.post](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.post](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) * @param {object} body - licenses to be installed @@ -40,7 +40,7 @@ function buildXpackLicensePost (opts) { } - return function xpackLicensePost (params, options, callback) { + return function licensePost (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -114,4 +114,4 @@ function buildXpackLicensePost (opts) { } } -module.exports = buildXpackLicensePost +module.exports = buildLicensePost diff --git a/api/api/xpack.license.post_start_basic.js b/api/api/license.post_start_basic.js similarity index 91% rename from api/api/xpack.license.post_start_basic.js rename to api/api/license.post_start_basic.js index c473ceb73..72d9bb04d 100644 --- a/api/api/xpack.license.post_start_basic.js +++ b/api/api/license.post_start_basic.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicensePostStartBasic (opts) { +function buildLicensePostStartBasic (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.post_start_basic](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.post_start_basic](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) */ @@ -39,7 +39,7 @@ function buildXpackLicensePostStartBasic (opts) { } - return function xpackLicensePostStartBasic (params, options, callback) { + return function licensePostStartBasic (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackLicensePostStartBasic (opts) { } } -module.exports = buildXpackLicensePostStartBasic +module.exports = buildLicensePostStartBasic diff --git a/api/api/xpack.license.post_start_trial.js b/api/api/license.post_start_trial.js similarity index 91% rename from api/api/xpack.license.post_start_trial.js rename to api/api/license.post_start_trial.js index 67fffcc4e..b99569790 100644 --- a/api/api/xpack.license.post_start_trial.js +++ b/api/api/license.post_start_trial.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackLicensePostStartTrial (opts) { +function buildLicensePostStartTrial (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.license.post_start_trial](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * Perform a [license.post_start_trial](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request * * @param {string} type - The type of trial license to generate (default: "trial") * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) @@ -41,7 +41,7 @@ function buildXpackLicensePostStartTrial (opts) { } - return function xpackLicensePostStartTrial (params, options, callback) { + return function licensePostStartTrial (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -121,4 +121,4 @@ function buildXpackLicensePostStartTrial (opts) { } } -module.exports = buildXpackLicensePostStartTrial +module.exports = buildLicensePostStartTrial diff --git a/api/api/xpack.migration.deprecations.js b/api/api/migration.deprecations.js similarity index 91% rename from api/api/xpack.migration.deprecations.js rename to api/api/migration.deprecations.js index d6d5edef8..cc5de6d85 100644 --- a/api/api/xpack.migration.deprecations.js +++ b/api/api/migration.deprecations.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackMigrationDeprecations (opts) { +function buildMigrationDeprecations (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.migration.deprecations](http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html) request + * Perform a [migration.deprecations](http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html) request * * @param {string} index - Index pattern */ @@ -39,7 +39,7 @@ function buildXpackMigrationDeprecations (opts) { } - return function xpackMigrationDeprecations (params, options, callback) { + return function migrationDeprecations (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackMigrationDeprecations (opts) { } } -module.exports = buildXpackMigrationDeprecations +module.exports = buildMigrationDeprecations diff --git a/api/api/ml.get_calendars.js b/api/api/ml.get_calendars.js index 365f18942..2792f7e50 100644 --- a/api/api/ml.get_calendars.js +++ b/api/api/ml.get_calendars.js @@ -31,6 +31,7 @@ function buildMlGetCalendars (opts) { * @param {string} calendar_id - The ID of the calendar to fetch * @param {int} from - skips a number of calendars * @param {int} size - specifies a max number of calendars to get + * @param {object} body - The from and size parameters optionally sent in the body */ const acceptedQuerystring = [ @@ -54,12 +55,6 @@ function buildMlGetCalendars (opts) { options = {} } - // check required parameters - if (params.body != null) { - const err = new ConfigurationError('This API does not require a body') - return handleError(err, callback) - } - // 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}`) @@ -91,7 +86,7 @@ function buildMlGetCalendars (opts) { const request = { method, path, - body: '', + body: body || '', querystring } diff --git a/api/api/reindex.js b/api/api/reindex.js index 90397417b..44949d112 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -33,6 +33,7 @@ function buildReindex (opts) { * @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) * @param {boolean} wait_for_completion - Should the request should block until the reindex is complete. * @param {number} requests_per_second - The throttle to set on this request in sub-requests per second. -1 means no throttle. + * @param {time} scroll - Control how long to keep the search context alive * @param {number} slices - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. * @param {object} body - The search definition using the Query DSL and the prototype for the index request. */ @@ -43,6 +44,7 @@ function buildReindex (opts) { 'wait_for_active_shards', 'wait_for_completion', 'requests_per_second', + 'scroll', 'slices', 'pretty', 'human', diff --git a/api/api/xpack.rollup.delete_job.js b/api/api/rollup.delete_job.js similarity index 94% rename from api/api/xpack.rollup.delete_job.js rename to api/api/rollup.delete_job.js index a4e960daa..353c35094 100644 --- a/api/api/xpack.rollup.delete_job.js +++ b/api/api/rollup.delete_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupDeleteJob (opts) { +function buildRollupDeleteJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.delete_job]() request + * Perform a [rollup.delete_job]() request * * @param {string} id - The ID of the job to delete */ @@ -39,7 +39,7 @@ function buildXpackRollupDeleteJob (opts) { } - return function xpackRollupDeleteJob (params, options, callback) { + return function rollupDeleteJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackRollupDeleteJob (opts) { } } -module.exports = buildXpackRollupDeleteJob +module.exports = buildRollupDeleteJob diff --git a/api/api/xpack.rollup.get_jobs.js b/api/api/rollup.get_jobs.js similarity index 94% rename from api/api/xpack.rollup.get_jobs.js rename to api/api/rollup.get_jobs.js index 90a58f40f..e88e8a8ef 100644 --- a/api/api/xpack.rollup.get_jobs.js +++ b/api/api/rollup.get_jobs.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupGetJobs (opts) { +function buildRollupGetJobs (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.get_jobs]() request + * Perform a [rollup.get_jobs]() request * * @param {string} id - The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs */ @@ -39,7 +39,7 @@ function buildXpackRollupGetJobs (opts) { } - return function xpackRollupGetJobs (params, options, callback) { + return function rollupGetJobs (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -117,4 +117,4 @@ function buildXpackRollupGetJobs (opts) { } } -module.exports = buildXpackRollupGetJobs +module.exports = buildRollupGetJobs diff --git a/api/api/xpack.rollup.get_rollup_caps.js b/api/api/rollup.get_rollup_caps.js similarity index 93% rename from api/api/xpack.rollup.get_rollup_caps.js rename to api/api/rollup.get_rollup_caps.js index 712061e83..aec85ccfa 100644 --- a/api/api/xpack.rollup.get_rollup_caps.js +++ b/api/api/rollup.get_rollup_caps.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupGetRollupCaps (opts) { +function buildRollupGetRollupCaps (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.get_rollup_caps]() request + * Perform a [rollup.get_rollup_caps]() request * * @param {string} id - The ID of the index to check rollup capabilities on, or left blank for all jobs */ @@ -39,7 +39,7 @@ function buildXpackRollupGetRollupCaps (opts) { } - return function xpackRollupGetRollupCaps (params, options, callback) { + return function rollupGetRollupCaps (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -117,4 +117,4 @@ function buildXpackRollupGetRollupCaps (opts) { } } -module.exports = buildXpackRollupGetRollupCaps +module.exports = buildRollupGetRollupCaps diff --git a/api/api/xpack.rollup.get_rollup_index_caps.js b/api/api/rollup.get_rollup_index_caps.js similarity index 93% rename from api/api/xpack.rollup.get_rollup_index_caps.js rename to api/api/rollup.get_rollup_index_caps.js index ceb97b228..1cf85f7c3 100644 --- a/api/api/xpack.rollup.get_rollup_index_caps.js +++ b/api/api/rollup.get_rollup_index_caps.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupGetRollupIndexCaps (opts) { +function buildRollupGetRollupIndexCaps (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.get_rollup_index_caps]() request + * Perform a [rollup.get_rollup_index_caps]() request * * @param {string} index - The rollup index or index pattern to obtain rollup capabilities from. */ @@ -39,7 +39,7 @@ function buildXpackRollupGetRollupIndexCaps (opts) { } - return function xpackRollupGetRollupIndexCaps (params, options, callback) { + return function rollupGetRollupIndexCaps (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackRollupGetRollupIndexCaps (opts) { } } -module.exports = buildXpackRollupGetRollupIndexCaps +module.exports = buildRollupGetRollupIndexCaps diff --git a/api/api/xpack.rollup.put_job.js b/api/api/rollup.put_job.js similarity index 94% rename from api/api/xpack.rollup.put_job.js rename to api/api/rollup.put_job.js index 48518f09e..5db700e80 100644 --- a/api/api/xpack.rollup.put_job.js +++ b/api/api/rollup.put_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupPutJob (opts) { +function buildRollupPutJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.put_job]() request + * Perform a [rollup.put_job]() request * * @param {string} id - The ID of the job to create * @param {object} body - The job configuration @@ -40,7 +40,7 @@ function buildXpackRollupPutJob (opts) { } - return function xpackRollupPutJob (params, options, callback) { + return function rollupPutJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -124,4 +124,4 @@ function buildXpackRollupPutJob (opts) { } } -module.exports = buildXpackRollupPutJob +module.exports = buildRollupPutJob diff --git a/api/api/xpack.rollup.rollup_search.js b/api/api/rollup.rollup_search.js similarity index 92% rename from api/api/xpack.rollup.rollup_search.js rename to api/api/rollup.rollup_search.js index b21faaf22..78094e181 100644 --- a/api/api/xpack.rollup.rollup_search.js +++ b/api/api/rollup.rollup_search.js @@ -22,13 +22,13 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupRollupSearch (opts) { +function buildRollupRollupSearch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.rollup_search]() request + * Perform a [rollup.rollup_search]() request * - * @param {string} index - The index or index-pattern (containing rollup or regular data) that should be searched + * @param {list} index - The indices or index-pattern(s) (containing rollup or regular data) that should be searched * @param {string} type - The doc type inside the index * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response * @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response @@ -45,7 +45,7 @@ function buildXpackRollupRollupSearch (opts) { restTotalHitsAsInt: 'rest_total_hits_as_int' } - return function xpackRollupRollupSearch (params, options, callback) { + return function rollupRollupSearch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -139,4 +139,4 @@ function buildXpackRollupRollupSearch (opts) { } } -module.exports = buildXpackRollupRollupSearch +module.exports = buildRollupRollupSearch diff --git a/api/api/xpack.rollup.start_job.js b/api/api/rollup.start_job.js similarity index 94% rename from api/api/xpack.rollup.start_job.js rename to api/api/rollup.start_job.js index 823221c1d..48abec711 100644 --- a/api/api/xpack.rollup.start_job.js +++ b/api/api/rollup.start_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupStartJob (opts) { +function buildRollupStartJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.start_job]() request + * Perform a [rollup.start_job]() request * * @param {string} id - The ID of the job to start */ @@ -39,7 +39,7 @@ function buildXpackRollupStartJob (opts) { } - return function xpackRollupStartJob (params, options, callback) { + return function rollupStartJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackRollupStartJob (opts) { } } -module.exports = buildXpackRollupStartJob +module.exports = buildRollupStartJob diff --git a/api/api/xpack.rollup.stop_job.js b/api/api/rollup.stop_job.js similarity index 94% rename from api/api/xpack.rollup.stop_job.js rename to api/api/rollup.stop_job.js index ad4683d83..1aa07fa2d 100644 --- a/api/api/xpack.rollup.stop_job.js +++ b/api/api/rollup.stop_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupStopJob (opts) { +function buildRollupStopJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.rollup.stop_job]() request + * Perform a [rollup.stop_job]() request * * @param {string} id - The ID of the job to stop * @param {boolean} wait_for_completion - True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false. @@ -43,7 +43,7 @@ function buildXpackRollupStopJob (opts) { } - return function xpackRollupStopJob (params, options, callback) { + return function rollupStopJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackRollupStopJob (opts) { } } -module.exports = buildXpackRollupStopJob +module.exports = buildRollupStopJob diff --git a/api/api/scripts_painless_context.js b/api/api/scripts_painless_context.js new file mode 100644 index 000000000..65e4fdac8 --- /dev/null +++ b/api/api/scripts_painless_context.js @@ -0,0 +1,122 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict' + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +function buildScriptsPainlessContext (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError } = opts + /** + * Perform a [scripts_painless_context](undefined) request + * + * @param {string} context - Select a specific context to retrieve API information about + */ + + const acceptedQuerystring = [ + 'context', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ] + + const snakeCase = { + errorTrace: 'error_trace', + filterPath: 'filter_path' + } + + return function scriptsPainlessContext (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 = null + var { method, body } = params + var querystring = semicopy(params, ['method', 'body']) + + if (method == null) { + method = 'GET' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + path = '/' + '_scripts' + '/' + 'painless' + '/' + '_context' + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + const requestOptions = { + ignore, + requestTimeout: options.requestTimeout || null, + maxRetries: options.maxRetries || null, + asStream: options.asStream || false, + headers: options.headers || null, + querystring: options.querystring || null, + compression: options.compression || false, + warnings + } + + return makeRequest(request, requestOptions, callback) + + function semicopy (obj, exclude) { + var target = {} + var keys = Object.keys(obj) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (exclude.indexOf(key) === -1) { + target[snakeCase[key] || key] = obj[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings = warnings || [] + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + } + return target + } + } +} + +module.exports = buildScriptsPainlessContext diff --git a/api/api/security.disable_user.js b/api/api/security.disable_user.js index d991c4853..a15e13b2a 100644 --- a/api/api/security.disable_user.js +++ b/api/api/security.disable_user.js @@ -53,6 +53,10 @@ function buildSecurityDisableUser (opts) { } // check required parameters + if (params['username'] == null) { + const err = new ConfigurationError('Missing required parameter: username') + return handleError(err, callback) + } if (params.body != null) { const err = new ConfigurationError('This API does not require a body') return handleError(err, callback) diff --git a/api/api/security.enable_user.js b/api/api/security.enable_user.js index de69556c4..f13274d71 100644 --- a/api/api/security.enable_user.js +++ b/api/api/security.enable_user.js @@ -53,6 +53,10 @@ function buildSecurityEnableUser (opts) { } // check required parameters + if (params['username'] == null) { + const err = new ConfigurationError('Missing required parameter: username') + return handleError(err, callback) + } if (params.body != null) { const err = new ConfigurationError('This API does not require a body') return handleError(err, callback) diff --git a/api/api/security.get_privileges.js b/api/api/security.get_privileges.js index fd2d39da1..ef4045ff1 100644 --- a/api/api/security.get_privileges.js +++ b/api/api/security.get_privileges.js @@ -85,9 +85,9 @@ function buildSecurityGetPrivileges (opts) { var path = '' - if (application && name) { + if ((application) != null && (name) != null) { path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application) + '/' + encodeURIComponent(name) - } else if (application) { + } else if ((application) != null) { path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application) } else { path = '/' + '_security' + '/' + 'privilege' diff --git a/api/api/security.put_role_mapping.js b/api/api/security.put_role_mapping.js index cd40cbad1..612bdb873 100644 --- a/api/api/security.put_role_mapping.js +++ b/api/api/security.put_role_mapping.js @@ -30,7 +30,7 @@ function buildSecurityPutRoleMapping (opts) { * * @param {string} name - Role-mapping name * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - * @param {object} body - The role to add + * @param {object} body - The role mapping to add */ const acceptedQuerystring = [ diff --git a/api/api/xpack.sql.clear_cursor.js b/api/api/sql.clear_cursor.js similarity index 93% rename from api/api/xpack.sql.clear_cursor.js rename to api/api/sql.clear_cursor.js index 79548622c..0dac8e9b5 100644 --- a/api/api/xpack.sql.clear_cursor.js +++ b/api/api/sql.clear_cursor.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackSqlClearCursor (opts) { +function buildSqlClearCursor (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.sql.clear_cursor](Clear SQL cursor) request + * Perform a [sql.clear_cursor](Clear SQL cursor) request * * @param {object} body - Specify the cursor value in the `cursor` element to clean the cursor. */ @@ -39,7 +39,7 @@ function buildXpackSqlClearCursor (opts) { } - return function xpackSqlClearCursor (params, options, callback) { + return function sqlClearCursor (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackSqlClearCursor (opts) { } } -module.exports = buildXpackSqlClearCursor +module.exports = buildSqlClearCursor diff --git a/api/api/xpack.sql.query.js b/api/api/sql.query.js similarity index 94% rename from api/api/xpack.sql.query.js rename to api/api/sql.query.js index 923190fef..0eb23acc2 100644 --- a/api/api/xpack.sql.query.js +++ b/api/api/sql.query.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackSqlQuery (opts) { +function buildSqlQuery (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.sql.query](Execute SQL) request + * Perform a [sql.query](Execute SQL) request * * @param {string} format - a short version of the Accept header, e.g. json, yaml * @param {object} body - Use the `query` element to start a query. Use the `cursor` element to continue a query. @@ -40,7 +40,7 @@ function buildXpackSqlQuery (opts) { } - return function xpackSqlQuery (params, options, callback) { + return function sqlQuery (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -120,4 +120,4 @@ function buildXpackSqlQuery (opts) { } } -module.exports = buildXpackSqlQuery +module.exports = buildSqlQuery diff --git a/api/api/xpack.sql.translate.js b/api/api/sql.translate.js similarity index 93% rename from api/api/xpack.sql.translate.js rename to api/api/sql.translate.js index c5204666e..be1325763 100644 --- a/api/api/xpack.sql.translate.js +++ b/api/api/sql.translate.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackSqlTranslate (opts) { +function buildSqlTranslate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.sql.translate](Translate SQL into Elasticsearch queries) request + * Perform a [sql.translate](Translate SQL into Elasticsearch queries) request * * @param {object} body - Specify the query in the `query` element. */ @@ -39,7 +39,7 @@ function buildXpackSqlTranslate (opts) { } - return function xpackSqlTranslate (params, options, callback) { + return function sqlTranslate (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackSqlTranslate (opts) { } } -module.exports = buildXpackSqlTranslate +module.exports = buildSqlTranslate diff --git a/api/api/xpack.watcher.ack_watch.js b/api/api/watcher.ack_watch.js similarity index 93% rename from api/api/xpack.watcher.ack_watch.js rename to api/api/watcher.ack_watch.js index 0dc0481b6..d7158969f 100644 --- a/api/api/xpack.watcher.ack_watch.js +++ b/api/api/watcher.ack_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherAckWatch (opts) { +function buildWatcherAckWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.ack_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html) request + * Perform a [watcher.ack_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html) request * * @param {string} watch_id - Watch ID * @param {list} action_id - A comma-separated list of the action ids to be acked @@ -40,7 +40,7 @@ function buildXpackWatcherAckWatch (opts) { } - return function xpackWatcherAckWatch (params, options, callback) { + return function watcherAckWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -134,4 +134,4 @@ function buildXpackWatcherAckWatch (opts) { } } -module.exports = buildXpackWatcherAckWatch +module.exports = buildWatcherAckWatch diff --git a/api/api/xpack.watcher.activate_watch.js b/api/api/watcher.activate_watch.js similarity index 91% rename from api/api/xpack.watcher.activate_watch.js rename to api/api/watcher.activate_watch.js index cadf57117..8012179d2 100644 --- a/api/api/xpack.watcher.activate_watch.js +++ b/api/api/watcher.activate_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherActivateWatch (opts) { +function buildWatcherActivateWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.activate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html) request + * Perform a [watcher.activate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html) request * * @param {string} watch_id - Watch ID */ @@ -39,7 +39,7 @@ function buildXpackWatcherActivateWatch (opts) { } - return function xpackWatcherActivateWatch (params, options, callback) { + return function watcherActivateWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackWatcherActivateWatch (opts) { } } -module.exports = buildXpackWatcherActivateWatch +module.exports = buildWatcherActivateWatch diff --git a/api/api/xpack.watcher.deactivate_watch.js b/api/api/watcher.deactivate_watch.js similarity index 91% rename from api/api/xpack.watcher.deactivate_watch.js rename to api/api/watcher.deactivate_watch.js index ce5f741bb..cd7cfa9bf 100644 --- a/api/api/xpack.watcher.deactivate_watch.js +++ b/api/api/watcher.deactivate_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherDeactivateWatch (opts) { +function buildWatcherDeactivateWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.deactivate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html) request + * Perform a [watcher.deactivate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html) request * * @param {string} watch_id - Watch ID */ @@ -39,7 +39,7 @@ function buildXpackWatcherDeactivateWatch (opts) { } - return function xpackWatcherDeactivateWatch (params, options, callback) { + return function watcherDeactivateWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackWatcherDeactivateWatch (opts) { } } -module.exports = buildXpackWatcherDeactivateWatch +module.exports = buildWatcherDeactivateWatch diff --git a/api/api/xpack.watcher.delete_watch.js b/api/api/watcher.delete_watch.js similarity index 91% rename from api/api/xpack.watcher.delete_watch.js rename to api/api/watcher.delete_watch.js index 15d5c2f8e..c126fea0c 100644 --- a/api/api/xpack.watcher.delete_watch.js +++ b/api/api/watcher.delete_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherDeleteWatch (opts) { +function buildWatcherDeleteWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request + * Perform a [watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request * * @param {string} id - Watch ID */ @@ -39,7 +39,7 @@ function buildXpackWatcherDeleteWatch (opts) { } - return function xpackWatcherDeleteWatch (params, options, callback) { + return function watcherDeleteWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackWatcherDeleteWatch (opts) { } } -module.exports = buildXpackWatcherDeleteWatch +module.exports = buildWatcherDeleteWatch diff --git a/api/api/xpack.watcher.execute_watch.js b/api/api/watcher.execute_watch.js similarity index 91% rename from api/api/xpack.watcher.execute_watch.js rename to api/api/watcher.execute_watch.js index b692e6045..633797a5d 100644 --- a/api/api/xpack.watcher.execute_watch.js +++ b/api/api/watcher.execute_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherExecuteWatch (opts) { +function buildWatcherExecuteWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.execute_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html) request + * Perform a [watcher.execute_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html) request * * @param {string} id - Watch ID * @param {boolean} debug - indicates whether the watch should execute in debug mode @@ -41,7 +41,7 @@ function buildXpackWatcherExecuteWatch (opts) { } - return function xpackWatcherExecuteWatch (params, options, callback) { + return function watcherExecuteWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -119,4 +119,4 @@ function buildXpackWatcherExecuteWatch (opts) { } } -module.exports = buildXpackWatcherExecuteWatch +module.exports = buildWatcherExecuteWatch diff --git a/api/api/xpack.watcher.get_watch.js b/api/api/watcher.get_watch.js similarity index 92% rename from api/api/xpack.watcher.get_watch.js rename to api/api/watcher.get_watch.js index 452b03ce8..807ec2643 100644 --- a/api/api/xpack.watcher.get_watch.js +++ b/api/api/watcher.get_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherGetWatch (opts) { +function buildWatcherGetWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.get_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html) request + * Perform a [watcher.get_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html) request * * @param {string} id - Watch ID */ @@ -39,7 +39,7 @@ function buildXpackWatcherGetWatch (opts) { } - return function xpackWatcherGetWatch (params, options, callback) { + return function watcherGetWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -123,4 +123,4 @@ function buildXpackWatcherGetWatch (opts) { } } -module.exports = buildXpackWatcherGetWatch +module.exports = buildWatcherGetWatch diff --git a/api/api/xpack.watcher.put_watch.js b/api/api/watcher.put_watch.js similarity index 92% rename from api/api/xpack.watcher.put_watch.js rename to api/api/watcher.put_watch.js index 35e973534..4f6d1d701 100644 --- a/api/api/xpack.watcher.put_watch.js +++ b/api/api/watcher.put_watch.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherPutWatch (opts) { +function buildWatcherPutWatch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.put_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html) request + * Perform a [watcher.put_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html) request * * @param {string} id - Watch ID * @param {boolean} active - Specify whether the watch is in/active by default @@ -48,7 +48,7 @@ function buildXpackWatcherPutWatch (opts) { ifPrimaryTerm: 'if_primary_term' } - return function xpackWatcherPutWatch (params, options, callback) { + return function watcherPutWatch (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -128,4 +128,4 @@ function buildXpackWatcherPutWatch (opts) { } } -module.exports = buildXpackWatcherPutWatch +module.exports = buildWatcherPutWatch diff --git a/api/api/xpack.watcher.start.js b/api/api/watcher.start.js similarity index 91% rename from api/api/xpack.watcher.start.js rename to api/api/watcher.start.js index 0684c8260..5cd32357c 100644 --- a/api/api/xpack.watcher.start.js +++ b/api/api/watcher.start.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherStart (opts) { +function buildWatcherStart (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.start](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html) request + * Perform a [watcher.start](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html) request * */ @@ -38,7 +38,7 @@ function buildXpackWatcherStart (opts) { } - return function xpackWatcherStart (params, options, callback) { + return function watcherStart (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -118,4 +118,4 @@ function buildXpackWatcherStart (opts) { } } -module.exports = buildXpackWatcherStart +module.exports = buildWatcherStart diff --git a/api/api/xpack.watcher.stats.js b/api/api/watcher.stats.js similarity index 89% rename from api/api/xpack.watcher.stats.js rename to api/api/watcher.stats.js index 444dfd49b..efdae5e0d 100644 --- a/api/api/xpack.watcher.stats.js +++ b/api/api/watcher.stats.js @@ -22,14 +22,14 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherStats (opts) { +function buildWatcherStats (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html) request + * Perform a [watcher.stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html) request * - * @param {enum} metric - Controls what additional stat metrics should be include in the response - * @param {enum} metric - Controls what additional stat metrics should be include in the response + * @param {list} metric - Controls what additional stat metrics should be include in the response + * @param {list} metric - Controls what additional stat metrics should be include in the response * @param {boolean} emit_stacktraces - Emits stack traces of currently running watches */ @@ -42,7 +42,7 @@ function buildXpackWatcherStats (opts) { emitStacktraces: 'emit_stacktraces' } - return function xpackWatcherStats (params, options, callback) { + return function watcherStats (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -126,4 +126,4 @@ function buildXpackWatcherStats (opts) { } } -module.exports = buildXpackWatcherStats +module.exports = buildWatcherStats diff --git a/api/api/xpack.watcher.stop.js b/api/api/watcher.stop.js similarity index 92% rename from api/api/xpack.watcher.stop.js rename to api/api/watcher.stop.js index 0490656ac..18cb40f9e 100644 --- a/api/api/xpack.watcher.stop.js +++ b/api/api/watcher.stop.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherStop (opts) { +function buildWatcherStop (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError } = opts /** - * Perform a [xpack.watcher.stop](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html) request + * Perform a [watcher.stop](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html) request * */ @@ -38,7 +38,7 @@ function buildXpackWatcherStop (opts) { } - return function xpackWatcherStop (params, options, callback) { + return function watcherStop (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -118,4 +118,4 @@ function buildXpackWatcherStop (opts) { } } -module.exports = buildXpackWatcherStop +module.exports = buildWatcherStop diff --git a/api/api/xpack.migration.get_assistance.js b/api/api/xpack.migration.get_assistance.js deleted file mode 100644 index 43e6041ac..000000000 --- a/api/api/xpack.migration.get_assistance.js +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -'use strict' - -/* eslint camelcase: 0 */ -/* eslint no-unused-vars: 0 */ - -function buildXpackMigrationGetAssistance (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts - /** - * Perform a [xpack.migration.get_assistance](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-assistance.html) request - * - * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. - * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) - */ - - const acceptedQuerystring = [ - 'allow_no_indices', - 'expand_wildcards', - 'ignore_unavailable' - ] - - const snakeCase = { - allowNoIndices: 'allow_no_indices', - expandWildcards: 'expand_wildcards', - ignoreUnavailable: 'ignore_unavailable' - } - - return function xpackMigrationGetAssistance (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 = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((index) != null) { - path = '/' + '_migration' + '/' + 'assistance' + '/' + encodeURIComponent(index) - } else { - path = '/' + '_migration' + '/' + 'assistance' - } - - // build request object - const request = { - method, - path, - body: null, - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } - } -} - -module.exports = buildXpackMigrationGetAssistance diff --git a/api/index.js b/api/index.js index 57622d189..d31ded72e 100644 --- a/api/index.js +++ b/api/index.js @@ -63,6 +63,8 @@ function ESAPI (opts) { followInfo: lazyLoad('ccr.follow_info', opts), follow_stats: lazyLoad('ccr.follow_stats', opts), followStats: lazyLoad('ccr.follow_stats', opts), + forget_follower: lazyLoad('ccr.forget_follower', opts), + forgetFollower: lazyLoad('ccr.forget_follower', opts), get_auto_follow_pattern: lazyLoad('ccr.get_auto_follow_pattern', opts), getAutoFollowPattern: lazyLoad('ccr.get_auto_follow_pattern', opts), pause_follow: lazyLoad('ccr.pause_follow', opts), @@ -94,6 +96,38 @@ function ESAPI (opts) { }, count: lazyLoad('count', opts), create: lazyLoad('create', opts), + data_frame: { + delete_data_frame_transform: lazyLoad('data_frame.delete_data_frame_transform', opts), + deleteDataFrameTransform: lazyLoad('data_frame.delete_data_frame_transform', opts), + get_data_frame_transform: lazyLoad('data_frame.get_data_frame_transform', opts), + getDataFrameTransform: lazyLoad('data_frame.get_data_frame_transform', opts), + get_data_frame_transform_stats: lazyLoad('data_frame.get_data_frame_transform_stats', opts), + getDataFrameTransformStats: lazyLoad('data_frame.get_data_frame_transform_stats', opts), + preview_data_frame_transform: lazyLoad('data_frame.preview_data_frame_transform', opts), + previewDataFrameTransform: lazyLoad('data_frame.preview_data_frame_transform', opts), + put_data_frame_transform: lazyLoad('data_frame.put_data_frame_transform', opts), + putDataFrameTransform: lazyLoad('data_frame.put_data_frame_transform', opts), + start_data_frame_transform: lazyLoad('data_frame.start_data_frame_transform', opts), + startDataFrameTransform: lazyLoad('data_frame.start_data_frame_transform', opts), + stop_data_frame_transform: lazyLoad('data_frame.stop_data_frame_transform', opts), + stopDataFrameTransform: lazyLoad('data_frame.stop_data_frame_transform', opts) + }, + dataFrame: { + delete_data_frame_transform: lazyLoad('data_frame.delete_data_frame_transform', opts), + deleteDataFrameTransform: lazyLoad('data_frame.delete_data_frame_transform', opts), + get_data_frame_transform: lazyLoad('data_frame.get_data_frame_transform', opts), + getDataFrameTransform: lazyLoad('data_frame.get_data_frame_transform', opts), + get_data_frame_transform_stats: lazyLoad('data_frame.get_data_frame_transform_stats', opts), + getDataFrameTransformStats: lazyLoad('data_frame.get_data_frame_transform_stats', opts), + preview_data_frame_transform: lazyLoad('data_frame.preview_data_frame_transform', opts), + previewDataFrameTransform: lazyLoad('data_frame.preview_data_frame_transform', opts), + put_data_frame_transform: lazyLoad('data_frame.put_data_frame_transform', opts), + putDataFrameTransform: lazyLoad('data_frame.put_data_frame_transform', opts), + start_data_frame_transform: lazyLoad('data_frame.start_data_frame_transform', opts), + startDataFrameTransform: lazyLoad('data_frame.start_data_frame_transform', opts), + stop_data_frame_transform: lazyLoad('data_frame.stop_data_frame_transform', opts), + stopDataFrameTransform: lazyLoad('data_frame.stop_data_frame_transform', opts) + }, delete: lazyLoad('delete', opts), delete_by_query: lazyLoad('delete_by_query', opts), deleteByQuery: lazyLoad('delete_by_query', opts), @@ -112,6 +146,9 @@ function ESAPI (opts) { getScript: lazyLoad('get_script', opts), get_source: lazyLoad('get_source', opts), getSource: lazyLoad('get_source', opts), + graph: { + explore: lazyLoad('graph.explore', opts) + }, ilm: { delete_lifecycle: lazyLoad('ilm.delete_lifecycle', opts), deleteLifecycle: lazyLoad('ilm.delete_lifecycle', opts), @@ -205,7 +242,23 @@ function ESAPI (opts) { putPipeline: lazyLoad('ingest.put_pipeline', opts), simulate: lazyLoad('ingest.simulate', opts) }, + license: { + delete: lazyLoad('license.delete', opts), + get: lazyLoad('license.get', opts), + get_basic_status: lazyLoad('license.get_basic_status', opts), + getBasicStatus: lazyLoad('license.get_basic_status', opts), + get_trial_status: lazyLoad('license.get_trial_status', opts), + getTrialStatus: lazyLoad('license.get_trial_status', opts), + post: lazyLoad('license.post', opts), + post_start_basic: lazyLoad('license.post_start_basic', opts), + postStartBasic: lazyLoad('license.post_start_basic', opts), + post_start_trial: lazyLoad('license.post_start_trial', opts), + postStartTrial: lazyLoad('license.post_start_trial', opts) + }, mget: lazyLoad('mget', opts), + migration: { + deprecations: lazyLoad('migration.deprecations', opts) + }, ml: { close_job: lazyLoad('ml.close_job', opts), closeJob: lazyLoad('ml.close_job', opts), @@ -323,6 +376,26 @@ function ESAPI (opts) { reindexRethrottle: lazyLoad('reindex_rethrottle', opts), render_search_template: lazyLoad('render_search_template', opts), renderSearchTemplate: lazyLoad('render_search_template', opts), + rollup: { + delete_job: lazyLoad('rollup.delete_job', opts), + deleteJob: lazyLoad('rollup.delete_job', opts), + get_jobs: lazyLoad('rollup.get_jobs', opts), + getJobs: lazyLoad('rollup.get_jobs', opts), + get_rollup_caps: lazyLoad('rollup.get_rollup_caps', opts), + getRollupCaps: lazyLoad('rollup.get_rollup_caps', opts), + get_rollup_index_caps: lazyLoad('rollup.get_rollup_index_caps', opts), + getRollupIndexCaps: lazyLoad('rollup.get_rollup_index_caps', opts), + put_job: lazyLoad('rollup.put_job', opts), + putJob: lazyLoad('rollup.put_job', opts), + rollup_search: lazyLoad('rollup.rollup_search', opts), + rollupSearch: lazyLoad('rollup.rollup_search', opts), + start_job: lazyLoad('rollup.start_job', opts), + startJob: lazyLoad('rollup.start_job', opts), + stop_job: lazyLoad('rollup.stop_job', opts), + stopJob: lazyLoad('rollup.stop_job', opts) + }, + scripts_painless_context: lazyLoad('scripts_painless_context', opts), + scriptsPainlessContext: lazyLoad('scripts_painless_context', opts), scripts_painless_execute: lazyLoad('scripts_painless_execute', opts), scriptsPainlessExecute: lazyLoad('scripts_painless_execute', opts), scroll: lazyLoad('scroll', opts), @@ -397,6 +470,12 @@ function ESAPI (opts) { verify_repository: lazyLoad('snapshot.verify_repository', opts), verifyRepository: lazyLoad('snapshot.verify_repository', opts) }, + sql: { + clear_cursor: lazyLoad('sql.clear_cursor', opts), + clearCursor: lazyLoad('sql.clear_cursor', opts), + query: lazyLoad('sql.query', opts), + translate: lazyLoad('sql.translate', opts) + }, ssl: { certificates: lazyLoad('ssl.certificates', opts) }, @@ -411,74 +490,28 @@ function ESAPI (opts) { updateByQuery: lazyLoad('update_by_query', opts), update_by_query_rethrottle: lazyLoad('update_by_query_rethrottle', opts), updateByQueryRethrottle: lazyLoad('update_by_query_rethrottle', opts), + watcher: { + ack_watch: lazyLoad('watcher.ack_watch', opts), + ackWatch: lazyLoad('watcher.ack_watch', opts), + activate_watch: lazyLoad('watcher.activate_watch', opts), + activateWatch: lazyLoad('watcher.activate_watch', opts), + deactivate_watch: lazyLoad('watcher.deactivate_watch', opts), + deactivateWatch: lazyLoad('watcher.deactivate_watch', opts), + delete_watch: lazyLoad('watcher.delete_watch', opts), + deleteWatch: lazyLoad('watcher.delete_watch', opts), + execute_watch: lazyLoad('watcher.execute_watch', opts), + executeWatch: lazyLoad('watcher.execute_watch', opts), + get_watch: lazyLoad('watcher.get_watch', opts), + getWatch: lazyLoad('watcher.get_watch', opts), + put_watch: lazyLoad('watcher.put_watch', opts), + putWatch: lazyLoad('watcher.put_watch', opts), + start: lazyLoad('watcher.start', opts), + stats: lazyLoad('watcher.stats', opts), + stop: lazyLoad('watcher.stop', opts) + }, xpack: { - graph: { - explore: lazyLoad('xpack.graph.explore', opts) - }, info: lazyLoad('xpack.info', opts), - license: { - delete: lazyLoad('xpack.license.delete', opts), - get: lazyLoad('xpack.license.get', opts), - get_basic_status: lazyLoad('xpack.license.get_basic_status', opts), - getBasicStatus: lazyLoad('xpack.license.get_basic_status', opts), - get_trial_status: lazyLoad('xpack.license.get_trial_status', opts), - getTrialStatus: lazyLoad('xpack.license.get_trial_status', opts), - post: lazyLoad('xpack.license.post', opts), - post_start_basic: lazyLoad('xpack.license.post_start_basic', opts), - postStartBasic: lazyLoad('xpack.license.post_start_basic', opts), - post_start_trial: lazyLoad('xpack.license.post_start_trial', opts), - postStartTrial: lazyLoad('xpack.license.post_start_trial', opts) - }, - migration: { - deprecations: lazyLoad('xpack.migration.deprecations', opts), - get_assistance: lazyLoad('xpack.migration.get_assistance', opts), - getAssistance: lazyLoad('xpack.migration.get_assistance', opts), - upgrade: lazyLoad('xpack.migration.upgrade', opts) - }, - rollup: { - delete_job: lazyLoad('xpack.rollup.delete_job', opts), - deleteJob: lazyLoad('xpack.rollup.delete_job', opts), - get_jobs: lazyLoad('xpack.rollup.get_jobs', opts), - getJobs: lazyLoad('xpack.rollup.get_jobs', opts), - get_rollup_caps: lazyLoad('xpack.rollup.get_rollup_caps', opts), - getRollupCaps: lazyLoad('xpack.rollup.get_rollup_caps', opts), - get_rollup_index_caps: lazyLoad('xpack.rollup.get_rollup_index_caps', opts), - getRollupIndexCaps: lazyLoad('xpack.rollup.get_rollup_index_caps', opts), - put_job: lazyLoad('xpack.rollup.put_job', opts), - putJob: lazyLoad('xpack.rollup.put_job', opts), - rollup_search: lazyLoad('xpack.rollup.rollup_search', opts), - rollupSearch: lazyLoad('xpack.rollup.rollup_search', opts), - start_job: lazyLoad('xpack.rollup.start_job', opts), - startJob: lazyLoad('xpack.rollup.start_job', opts), - stop_job: lazyLoad('xpack.rollup.stop_job', opts), - stopJob: lazyLoad('xpack.rollup.stop_job', opts) - }, - sql: { - clear_cursor: lazyLoad('xpack.sql.clear_cursor', opts), - clearCursor: lazyLoad('xpack.sql.clear_cursor', opts), - query: lazyLoad('xpack.sql.query', opts), - translate: lazyLoad('xpack.sql.translate', opts) - }, - usage: lazyLoad('xpack.usage', opts), - watcher: { - ack_watch: lazyLoad('xpack.watcher.ack_watch', opts), - ackWatch: lazyLoad('xpack.watcher.ack_watch', opts), - activate_watch: lazyLoad('xpack.watcher.activate_watch', opts), - activateWatch: lazyLoad('xpack.watcher.activate_watch', opts), - deactivate_watch: lazyLoad('xpack.watcher.deactivate_watch', opts), - deactivateWatch: lazyLoad('xpack.watcher.deactivate_watch', opts), - delete_watch: lazyLoad('xpack.watcher.delete_watch', opts), - deleteWatch: lazyLoad('xpack.watcher.delete_watch', opts), - execute_watch: lazyLoad('xpack.watcher.execute_watch', opts), - executeWatch: lazyLoad('xpack.watcher.execute_watch', opts), - get_watch: lazyLoad('xpack.watcher.get_watch', opts), - getWatch: lazyLoad('xpack.watcher.get_watch', opts), - put_watch: lazyLoad('xpack.watcher.put_watch', opts), - putWatch: lazyLoad('xpack.watcher.put_watch', opts), - start: lazyLoad('xpack.watcher.start', opts), - stats: lazyLoad('xpack.watcher.stats', opts), - stop: lazyLoad('xpack.watcher.stop', opts) - } + usage: lazyLoad('xpack.usage', opts) } } diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 755fddf88..7f2cd898d 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -115,6 +115,7 @@ export interface CatIndices extends Generic { pri?: boolean; s?: string | string[]; v?: boolean; + include_unloaded_segments?: boolean; } export interface CatMaster extends Generic { @@ -277,6 +278,7 @@ export interface ClusterGetSettings extends Generic { export interface ClusterHealth extends Generic { index?: string | string[]; + expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; level?: 'cluster' | 'indices' | 'shards'; local?: boolean; master_timeout?: string; @@ -574,6 +576,7 @@ export interface IndicesClose extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + wait_for_active_shards?: string; } export interface IndicesCreate extends Generic { @@ -835,7 +838,6 @@ export interface IndicesShardStores extends Generic { export interface IndicesShrink extends Generic { index: string; target: string; - copy_settings?: boolean; timeout?: string; master_timeout?: string; wait_for_active_shards?: string; @@ -845,7 +847,6 @@ export interface IndicesShrink extends Generic { export interface IndicesSplit extends Generic { index: string; target: string; - copy_settings?: boolean; timeout?: string; master_timeout?: string; wait_for_active_shards?: string; @@ -862,6 +863,9 @@ export interface IndicesStats extends Generic { level?: 'cluster' | 'indices' | 'shards'; types?: string | string[]; include_segment_file_sizes?: boolean; + include_unloaded_segments?: boolean; + expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + forbid_closed_indices?: boolean; } export interface IndicesUpdateAliases extends Generic { @@ -1051,6 +1055,7 @@ export interface Reindex extends Generic { wait_for_active_shards?: string; wait_for_completion?: boolean; requests_per_second?: number; + scroll?: string; slices?: number; body: any; } @@ -1065,6 +1070,10 @@ export interface RenderSearchTemplate extends Generic { body?: any; } +export interface ScriptsPainlessContext extends Generic { + context?: string; +} + export interface ScriptsPainlessExecute extends Generic { body?: any; } @@ -1337,7 +1346,12 @@ export interface CcrFollowInfo extends Generic { } export interface CcrFollowStats extends Generic { - index?: string | string[]; + index: string | string[]; +} + +export interface CcrForgetFollower extends Generic { + index: string; + body: any; } export interface CcrGetAutoFollowPattern extends Generic { @@ -1365,13 +1379,54 @@ export interface CcrUnfollow extends Generic { index: string; } +export interface DataFrameDeleteDataFrameTransform extends Generic { + transform_id: string; +} + +export interface DataFrameGetDataFrameTransform extends Generic { + transform_id?: string; + from?: number; + size?: number; +} + +export interface DataFrameGetDataFrameTransformStats extends Generic { + transform_id?: string; +} + +export interface DataFramePreviewDataFrameTransform extends Generic { + body: any; +} + +export interface DataFramePutDataFrameTransform extends Generic { + transform_id: string; + body: any; +} + +export interface DataFrameStartDataFrameTransform extends Generic { + transform_id: string; + timeout?: string; +} + +export interface DataFrameStopDataFrameTransform extends Generic { + transform_id: string; + wait_for_completion?: boolean; + timeout?: string; +} + +export interface GraphExplore extends Generic { + index?: string | string[]; + type?: string | string[]; + routing?: string; + timeout?: string; + body?: any; +} + export interface IlmDeleteLifecycle extends Generic { policy?: string; } export interface IlmExplainLifecycle extends Generic { index?: string; - human?: boolean; } export interface IlmGetLifecycle extends Generic { @@ -1425,6 +1480,37 @@ export interface IndicesUnfreeze extends Generic { wait_for_active_shards?: string; } +export interface LicenseDelete extends Generic { +} + +export interface LicenseGet extends Generic { + local?: boolean; +} + +export interface LicenseGetBasicStatus extends Generic { +} + +export interface LicenseGetTrialStatus extends Generic { +} + +export interface LicensePost extends Generic { + acknowledge?: boolean; + body?: any; +} + +export interface LicensePostStartBasic extends Generic { + acknowledge?: boolean; +} + +export interface LicensePostStartTrial extends Generic { + type?: string; + acknowledge?: boolean; +} + +export interface MigrationDeprecations extends Generic { + index?: string; +} + export interface MlCloseJob extends Generic { job_id: string; allow_no_jobs?: boolean; @@ -1538,6 +1624,7 @@ export interface MlGetCalendars extends Generic { calendar_id?: string; from?: number; size?: number; + body?: any; } export interface MlGetCategories extends Generic { @@ -1738,6 +1825,45 @@ export interface MonitoringBulk extends Generic { body: any; } +export interface RollupDeleteJob extends Generic { + id: string; +} + +export interface RollupGetJobs extends Generic { + id?: string; +} + +export interface RollupGetRollupCaps extends Generic { + id?: string; +} + +export interface RollupGetRollupIndexCaps extends Generic { + index: string; +} + +export interface RollupPutJob extends Generic { + id: string; + body: any; +} + +export interface RollupRollupSearch extends Generic { + index: string | string[]; + type?: string; + typed_keys?: boolean; + rest_total_hits_as_int?: boolean; + body: any; +} + +export interface RollupStartJob extends Generic { + id: string; +} + +export interface RollupStopJob extends Generic { + id: string; + wait_for_completion?: boolean; + timeout?: string; +} + export interface SecurityAuthenticate extends Generic { } @@ -1783,12 +1909,12 @@ export interface SecurityDeleteUser extends Generic { } export interface SecurityDisableUser extends Generic { - username?: string; + username: string; refresh?: 'true' | 'false' | 'wait_for'; } export interface SecurityEnableUser extends Generic { - username?: string; + username: string; refresh?: 'true' | 'false' | 'wait_for'; } @@ -1859,148 +1985,50 @@ export interface SecurityPutUser extends Generic { body: any; } -export interface SslCertificates extends Generic { -} - -export interface XpackGraphExplore extends Generic { - index?: string | string[]; - type?: string | string[]; - routing?: string; - timeout?: string; - body?: any; -} - -export interface XpackInfo extends Generic { - categories?: string | string[]; -} - -export interface XpackLicenseDelete extends Generic { -} - -export interface XpackLicenseGet extends Generic { - local?: boolean; -} - -export interface XpackLicenseGetBasicStatus extends Generic { -} - -export interface XpackLicenseGetTrialStatus extends Generic { -} - -export interface XpackLicensePost extends Generic { - acknowledge?: boolean; - body?: any; -} - -export interface XpackLicensePostStartBasic extends Generic { - acknowledge?: boolean; -} - -export interface XpackLicensePostStartTrial extends Generic { - type?: string; - acknowledge?: boolean; -} - -export interface XpackMigrationDeprecations extends Generic { - index?: string; -} - -export interface XpackMigrationGetAssistance extends Generic { - index?: string | string[]; - allow_no_indices?: boolean; - expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; - ignore_unavailable?: boolean; -} - -export interface XpackMigrationUpgrade extends Generic { - index: string; - wait_for_completion?: boolean; -} - -export interface XpackRollupDeleteJob extends Generic { - id: string; -} - -export interface XpackRollupGetJobs extends Generic { - id?: string; -} - -export interface XpackRollupGetRollupCaps extends Generic { - id?: string; -} - -export interface XpackRollupGetRollupIndexCaps extends Generic { - index: string; -} - -export interface XpackRollupPutJob extends Generic { - id: string; +export interface SqlClearCursor extends Generic { body: any; } -export interface XpackRollupRollupSearch extends Generic { - index: string; - type?: string; - typed_keys?: boolean; - rest_total_hits_as_int?: boolean; - body: any; -} - -export interface XpackRollupStartJob extends Generic { - id: string; -} - -export interface XpackRollupStopJob extends Generic { - id: string; - wait_for_completion?: boolean; - timeout?: string; -} - -export interface XpackSqlClearCursor extends Generic { - body: any; -} - -export interface XpackSqlQuery extends Generic { +export interface SqlQuery extends Generic { format?: string; body: any; } -export interface XpackSqlTranslate extends Generic { +export interface SqlTranslate extends Generic { body: any; } -export interface XpackUsage extends Generic { - master_timeout?: string; +export interface SslCertificates extends Generic { } -export interface XpackWatcherAckWatch extends Generic { +export interface WatcherAckWatch extends Generic { watch_id: string; action_id?: string | string[]; } -export interface XpackWatcherActivateWatch extends Generic { +export interface WatcherActivateWatch extends Generic { watch_id: string; } -export interface XpackWatcherDeactivateWatch extends Generic { +export interface WatcherDeactivateWatch extends Generic { watch_id: string; } -export interface XpackWatcherDeleteWatch extends Generic { +export interface WatcherDeleteWatch extends Generic { id: string; } -export interface XpackWatcherExecuteWatch extends Generic { +export interface WatcherExecuteWatch extends Generic { id?: string; debug?: boolean; body?: any; } -export interface XpackWatcherGetWatch extends Generic { +export interface WatcherGetWatch extends Generic { id: string; } -export interface XpackWatcherPutWatch extends Generic { +export interface WatcherPutWatch extends Generic { id: string; active?: boolean; version?: number; @@ -2009,13 +2037,21 @@ export interface XpackWatcherPutWatch extends Generic { body?: any; } -export interface XpackWatcherStart extends Generic { +export interface WatcherStart extends Generic { } -export interface XpackWatcherStats extends Generic { - metric?: '_all' | 'queued_watches' | 'current_watches' | 'pending_watches'; +export interface WatcherStats extends Generic { + metric?: string | string[]; emit_stacktraces?: boolean; } -export interface XpackWatcherStop extends Generic { +export interface WatcherStop extends Generic { +} + +export interface XpackInfo extends Generic { + categories?: string | string[]; +} + +export interface XpackUsage extends Generic { + master_timeout?: string; } diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 82257cb39..1ce137e78 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -312,6 +312,9 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html |`v` |`boolean` - Verbose mode. Display column headers +|`include_unloaded_segments` or `includeUnloadedSegments` +|`boolean` - If set to true segment stats will include stats for segments that are not currently loaded into memory + |=== === cat.master @@ -815,6 +818,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.htm |`index` |`string, string[]` - Limit the information returned to a specific index +|`expand_wildcards` or `expandWildcards` +|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +_Default:_ `all` + |`level` |`'cluster', 'indices', 'shards'` - Specify the level of detail for returned information + _Default:_ `cluster` @@ -1748,6 +1755,9 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close |`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + _Default:_ `open` +|`wait_for_active_shards` or `waitForActiveShards` +|`string` - Sets the number of active shards to wait for before the operation returns. + |=== === indices.create @@ -2579,9 +2589,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-ind |`target` |`string` - The name of the target index to shrink into -|`copy_settings` or `copySettings` -|`boolean` - whether or not to copy settings from the source index (defaults to false) - |`timeout` |`string` - Explicit operation timeout @@ -2610,9 +2617,6 @@ http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-inde |`target` |`string` - The name of the target index to split into -|`copy_settings` or `copySettings` -|`boolean` - whether or not to copy settings from the source index (defaults to false) - |`timeout` |`string` - Explicit operation timeout @@ -2663,6 +2667,17 @@ _Default:_ `indices` |`include_segment_file_sizes` or `includeSegmentFileSizes` |`boolean` - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) +|`include_unloaded_segments` or `includeUnloadedSegments` +|`boolean` - If set to true segment stats will include stats for segments that are not currently loaded into memory + +|`expand_wildcards` or `expandWildcards` +|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +_Default:_ `open` + +|`forbid_closed_indices` or `forbidClosedIndices` +|`boolean` - If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices + +_Default:_ `true` + |=== === indices.updateAliases @@ -3264,6 +3279,10 @@ _Default:_ `true` |`requests_per_second` or `requestsPerSecond` |`number` - The throttle to set on this request in sub-requests per second. -1 means no throttle. +|`scroll` +|`string` - Control how long to keep the search context alive + +_Default:_ `5m` + |`slices` |`number` - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. + _Default:_ `1` @@ -3305,6 +3324,19 @@ http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-temp |=== +=== scriptsPainlessContext +[source,js] +---- +client.scriptsPainlessContext([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`context` +|`string` - Select a specific context to retrieve API information about + +|=== + === scriptsPainlessExecute [source,js] ---- @@ -4181,6 +4213,22 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-s |=== +=== ccr.forgetFollower +[source,js] +---- +client.ccr.forgetFollower([params] [, options] [, callback]) +---- +http://www.elastic.co/guide/en/elasticsearch/reference/current +[cols=2*] +|=== +|`index` +|`string` - the name of the leader index for which specified follower retention leases should be removed + +|`body` +|`object` - the name and UUID of the follower index, the name of the cluster containing the follower index, and the alias from the perspective of that cluster for the remote cluster containing the leader index + +|=== + === ccr.getAutoFollowPattern [source,js] ---- @@ -4260,6 +4308,140 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current |=== +=== dataFrame.deleteDataFrameTransform +[source,js] +---- +client.dataFrame.deleteDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-data-frame-transform.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the transform to delete + +|=== + +=== dataFrame.getDataFrameTransform +[source,js] +---- +client.dataFrame.getDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get 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 + +|=== + +=== dataFrame.getDataFrameTransformStats +[source,js] +---- +client.dataFrame.getDataFrameTransformStats([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform-stats.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the transform for which to get stats. '_all' or '*' implies all transforms + +|=== + +=== dataFrame.previewDataFrameTransform +[source,js] +---- +client.dataFrame.previewDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-data-frame-transform.html +[cols=2*] +|=== +|`body` +|`object` - The definition for the data_frame transform to preview + +|=== + +=== dataFrame.putDataFrameTransform +[source,js] +---- +client.dataFrame.putDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/put-data-frame-transform.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the new transform. + +|`body` +|`object` - The data frame transform definition + +|=== + +=== dataFrame.startDataFrameTransform +[source,js] +---- +client.dataFrame.startDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/start-data-frame-transform.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the transform to start + +|`timeout` +|`string` - Controls the time to wait for the transform to start + +|=== + +=== dataFrame.stopDataFrameTransform +[source,js] +---- +client.dataFrame.stopDataFrameTransform([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-data-frame-transform.html +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the transform to stop + +|`wait_for_completion` or `waitForCompletion` +|`boolean` - Whether to wait for the transform to fully stop before returning or not. Default to false + +|`timeout` +|`string` - Controls the time to wait until the transform has stopped. Default to 30 seconds + +|=== + +=== graph.explore +[source,js] +---- +client.graph.explore([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html +[cols=2*] +|=== +|`index` +|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + +|`type` +|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types + +|`routing` +|`string` - Specific routing value + +|`timeout` +|`string` - Explicit operation timeout + +|`body` +|`object` - Graph Query DSL + +|=== + === ilm.deleteLifecycle [source,js] ---- @@ -4284,10 +4466,6 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-life |`index` |`string` - The name of the index to explain -|`human` -|`boolean` - Return data such as dates in a human readable format + -_Default:_ `false` - |=== === ilm.getLifecycle @@ -4449,6 +4627,101 @@ _Default:_ `closed` |=== +=== license.delete +[source,js] +---- +client.license.delete([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html + + +=== license.get +[source,js] +---- +client.license.get([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html +[cols=2*] +|=== +|`local` +|`boolean` - Return local information, do not retrieve the state from master node (default: false) + +|=== + +=== license.getBasicStatus +[source,js] +---- +client.license.getBasicStatus([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html + + +=== license.getTrialStatus +[source,js] +---- +client.license.getTrialStatus([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html + + +=== license.post +[source,js] +---- +client.license.post([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html +[cols=2*] +|=== +|`acknowledge` +|`boolean` - whether the user has acknowledged acknowledge messages (default: false) + +|`body` +|`object` - licenses to be installed + +|=== + +=== license.postStartBasic +[source,js] +---- +client.license.postStartBasic([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html +[cols=2*] +|=== +|`acknowledge` +|`boolean` - whether the user has acknowledged acknowledge messages (default: false) + +|=== + +=== license.postStartTrial +[source,js] +---- +client.license.postStartTrial([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/x-pack/current/license-management.html +[cols=2*] +|=== +|`type` +|`string` - The type of trial license to generate (default: "trial") + +|`acknowledge` +|`boolean` - whether the user has acknowledged acknowledge messages (default: false) + +|=== + +=== migration.deprecations +[source,js] +---- +client.migration.deprecations([params] [, options] [, callback]) +---- +http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html +[cols=2*] +|=== +|`index` +|`string` - Index pattern + +|=== + === ml.closeJob [source,js] ---- @@ -4809,6 +5082,9 @@ client.ml.getCalendars([params] [, options] [, callback]) |`size` |`number` - specifies a max number of calendars to get +|`body` +|`object` - The from and size parameters optionally sent in the body + |=== === ml.getCategories @@ -5434,6 +5710,131 @@ http://www.elastic.co/guide/en/monitoring/current/appendix-api-bulk.html |=== +=== rollup.deleteJob +[source,js] +---- +client.rollup.deleteJob([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`id` +|`string` - The ID of the job to delete + +|=== + +=== rollup.getJobs +[source,js] +---- +client.rollup.getJobs([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`id` +|`string` - The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs + +|=== + +=== rollup.getRollupCaps +[source,js] +---- +client.rollup.getRollupCaps([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`id` +|`string` - The ID of the index to check rollup capabilities on, or left blank for all jobs + +|=== + +=== rollup.getRollupIndexCaps +[source,js] +---- +client.rollup.getRollupIndexCaps([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`index` +|`string` - The rollup index or index pattern to obtain rollup capabilities from. + +|=== + +=== rollup.putJob +[source,js] +---- +client.rollup.putJob([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`id` +|`string` - The ID of the job to create + +|`body` +|`object` - The job configuration + +|=== + +=== rollup.rollupSearch +[source,js] +---- +client.rollup.rollupSearch([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`index` +|`string, string[]` - The indices or index-pattern(s) (containing rollup or regular data) that should be searched + +|`type` +|`string` - The doc type inside the index + +|`typed_keys` or `typedKeys` +|`boolean` - Specify whether aggregation and suggester names should be prefixed by their respective types in the response + +|`rest_total_hits_as_int` or `restTotalHitsAsInt` +|`boolean` - Indicates whether hits.total should be rendered as an integer or an object in the rest search response + +|`body` +|`object` - The search request body + +|=== + +=== rollup.startJob +[source,js] +---- +client.rollup.startJob([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`id` +|`string` - The ID of the job to start + +|=== + +=== rollup.stopJob +[source,js] +---- +client.rollup.stopJob([params] [, options] [, callback]) +---- + +[cols=2*] +|=== +|`id` +|`string` - The ID of the job to stop + +|`wait_for_completion` or `waitForCompletion` +|`boolean` - True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false. + +|`timeout` +|`string` - Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s. + +|=== + === security.authenticate [source,js] ---- @@ -5795,7 +6196,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put |`'true', 'false', 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. |`body` -|`object` - The role to add +|`object` - The role mapping to add |=== @@ -5818,316 +6219,10 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put |=== -=== ssl.certificates +=== sql.clearCursor [source,js] ---- -client.ssl.certificates([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html - - -=== xpack.graph.explore -[source,js] ----- -client.xpack.graph.explore([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html -[cols=2*] -|=== -|`index` -|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - -|`type` -|`string, string[]` - A comma-separated list of document types to search; leave empty to perform the operation on all types - -|`routing` -|`string` - Specific routing value - -|`timeout` -|`string` - Explicit operation timeout - -|`body` -|`object` - Graph Query DSL - -|=== - -=== xpack.info -[source,js] ----- -client.xpack.info([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html -[cols=2*] -|=== -|`categories` -|`string, string[]` - Comma-separated list of info categories. Can be any of: build, license, features - -|=== - -=== xpack.license.delete -[source,js] ----- -client.xpack.license.delete([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html - - -=== xpack.license.get -[source,js] ----- -client.xpack.license.get([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html -[cols=2*] -|=== -|`local` -|`boolean` - Return local information, do not retrieve the state from master node (default: false) - -|=== - -=== xpack.license.getBasicStatus -[source,js] ----- -client.xpack.license.getBasicStatus([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html - - -=== xpack.license.getTrialStatus -[source,js] ----- -client.xpack.license.getTrialStatus([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html - - -=== xpack.license.post -[source,js] ----- -client.xpack.license.post([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html -[cols=2*] -|=== -|`acknowledge` -|`boolean` - whether the user has acknowledged acknowledge messages (default: false) - -|`body` -|`object` - licenses to be installed - -|=== - -=== xpack.license.postStartBasic -[source,js] ----- -client.xpack.license.postStartBasic([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html -[cols=2*] -|=== -|`acknowledge` -|`boolean` - whether the user has acknowledged acknowledge messages (default: false) - -|=== - -=== xpack.license.postStartTrial -[source,js] ----- -client.xpack.license.postStartTrial([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/x-pack/current/license-management.html -[cols=2*] -|=== -|`type` -|`string` - The type of trial license to generate (default: "trial") - -|`acknowledge` -|`boolean` - whether the user has acknowledged acknowledge messages (default: false) - -|=== - -=== xpack.migration.deprecations -[source,js] ----- -client.xpack.migration.deprecations([params] [, options] [, callback]) ----- -http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html -[cols=2*] -|=== -|`index` -|`string` - Index pattern - -|=== - -=== xpack.migration.getAssistance -[source,js] ----- -client.xpack.migration.getAssistance([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-assistance.html -[cols=2*] -|=== -|`index` -|`string, string[]` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - -|`allow_no_indices` or `allowNoIndices` -|`boolean` - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - -|`expand_wildcards` or `expandWildcards` -|`'open', 'closed', 'none', 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + -_Default:_ `open` - -|`ignore_unavailable` or `ignoreUnavailable` -|`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) - -|=== - -=== xpack.migration.upgrade -[source,js] ----- -client.xpack.migration.upgrade([params] [, options] [, callback]) ----- -https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html -[cols=2*] -|=== -|`index` -|`string` - The name of the index - -|`wait_for_completion` or `waitForCompletion` -|`boolean` - Should the request block until the upgrade operation is completed + -_Default:_ `true` - -|=== - -=== xpack.rollup.deleteJob -[source,js] ----- -client.xpack.rollup.deleteJob([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the job to delete - -|=== - -=== xpack.rollup.getJobs -[source,js] ----- -client.xpack.rollup.getJobs([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs - -|=== - -=== xpack.rollup.getRollupCaps -[source,js] ----- -client.xpack.rollup.getRollupCaps([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the index to check rollup capabilities on, or left blank for all jobs - -|=== - -=== xpack.rollup.getRollupIndexCaps -[source,js] ----- -client.xpack.rollup.getRollupIndexCaps([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`index` -|`string` - The rollup index or index pattern to obtain rollup capabilities from. - -|=== - -=== xpack.rollup.putJob -[source,js] ----- -client.xpack.rollup.putJob([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the job to create - -|`body` -|`object` - The job configuration - -|=== - -=== xpack.rollup.rollupSearch -[source,js] ----- -client.xpack.rollup.rollupSearch([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`index` -|`string` - The index or index-pattern (containing rollup or regular data) that should be searched - -|`type` -|`string` - The doc type inside the index - -|`typed_keys` or `typedKeys` -|`boolean` - Specify whether aggregation and suggester names should be prefixed by their respective types in the response - -|`rest_total_hits_as_int` or `restTotalHitsAsInt` -|`boolean` - Indicates whether hits.total should be rendered as an integer or an object in the rest search response - -|`body` -|`object` - The search request body - -|=== - -=== xpack.rollup.startJob -[source,js] ----- -client.xpack.rollup.startJob([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the job to start - -|=== - -=== xpack.rollup.stopJob -[source,js] ----- -client.xpack.rollup.stopJob([params] [, options] [, callback]) ----- - -[cols=2*] -|=== -|`id` -|`string` - The ID of the job to stop - -|`wait_for_completion` or `waitForCompletion` -|`boolean` - True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false. - -|`timeout` -|`string` - Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s. - -|=== - -=== xpack.sql.clearCursor -[source,js] ----- -client.xpack.sql.clearCursor([params] [, options] [, callback]) +client.sql.clearCursor([params] [, options] [, callback]) ---- Clear SQL cursor [cols=2*] @@ -6137,10 +6232,10 @@ Clear SQL cursor |=== -=== xpack.sql.query +=== sql.query [source,js] ---- -client.xpack.sql.query([params] [, options] [, callback]) +client.sql.query([params] [, options] [, callback]) ---- Execute SQL [cols=2*] @@ -6153,10 +6248,10 @@ Execute SQL |=== -=== xpack.sql.translate +=== sql.translate [source,js] ---- -client.xpack.sql.translate([params] [, options] [, callback]) +client.sql.translate([params] [, options] [, callback]) ---- Translate SQL into Elasticsearch queries [cols=2*] @@ -6166,23 +6261,18 @@ Translate SQL into Elasticsearch queries |=== -=== xpack.usage +=== ssl.certificates [source,js] ---- -client.xpack.usage([params] [, options] [, callback]) +client.ssl.certificates([params] [, options] [, callback]) ---- -Retrieve information about xpack features usage -[cols=2*] -|=== -|`master_timeout` or `masterTimeout` -|`string` - Specify timeout for watch write operation +https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html -|=== -=== xpack.watcher.ackWatch +=== watcher.ackWatch [source,js] ---- -client.xpack.watcher.ackWatch([params] [, options] [, callback]) +client.watcher.ackWatch([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html [cols=2*] @@ -6195,10 +6285,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-w |=== -=== xpack.watcher.activateWatch +=== watcher.activateWatch [source,js] ---- -client.xpack.watcher.activateWatch([params] [, options] [, callback]) +client.watcher.activateWatch([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html [cols=2*] @@ -6208,10 +6298,10 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-acti |=== -=== xpack.watcher.deactivateWatch +=== watcher.deactivateWatch [source,js] ---- -client.xpack.watcher.deactivateWatch([params] [, options] [, callback]) +client.watcher.deactivateWatch([params] [, options] [, callback]) ---- https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html [cols=2*] @@ -6221,10 +6311,10 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deac |=== -=== xpack.watcher.deleteWatch +=== watcher.deleteWatch [source,js] ---- -client.xpack.watcher.deleteWatch([params] [, options] [, callback]) +client.watcher.deleteWatch([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html [cols=2*] @@ -6234,10 +6324,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delet |=== -=== xpack.watcher.executeWatch +=== watcher.executeWatch [source,js] ---- -client.xpack.watcher.executeWatch([params] [, options] [, callback]) +client.watcher.executeWatch([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html [cols=2*] @@ -6253,10 +6343,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execu |=== -=== xpack.watcher.getWatch +=== watcher.getWatch [source,js] ---- -client.xpack.watcher.getWatch([params] [, options] [, callback]) +client.watcher.getWatch([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html [cols=2*] @@ -6266,10 +6356,10 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-w |=== -=== xpack.watcher.putWatch +=== watcher.putWatch [source,js] ---- -client.xpack.watcher.putWatch([params] [, options] [, callback]) +client.watcher.putWatch([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html [cols=2*] @@ -6294,37 +6384,63 @@ http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-w |=== -=== xpack.watcher.start +=== watcher.start [source,js] ---- -client.xpack.watcher.start([params] [, options] [, callback]) +client.watcher.start([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html -=== xpack.watcher.stats +=== watcher.stats [source,js] ---- -client.xpack.watcher.stats([params] [, options] [, callback]) +client.watcher.stats([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html [cols=2*] |=== |`metric` -|`'_all', 'queued_watches', 'current_watches', 'pending_watches'` - Controls what additional stat metrics should be include in the response +|`string, string[]` - Controls what additional stat metrics should be include in the response |`metric` -|`'_all', 'queued_watches', 'current_watches', 'pending_watches'` - Controls what additional stat metrics should be include in the response +|`string, string[]` - Controls what additional stat metrics should be include in the response |`emit_stacktraces` or `emitStacktraces` |`boolean` - Emits stack traces of currently running watches |=== -=== xpack.watcher.stop +=== watcher.stop [source,js] ---- -client.xpack.watcher.stop([params] [, options] [, callback]) +client.watcher.stop([params] [, options] [, callback]) ---- http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html + +=== xpack.info +[source,js] +---- +client.xpack.info([params] [, options] [, callback]) +---- +https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html +[cols=2*] +|=== +|`categories` +|`string, string[]` - Comma-separated list of info categories. Can be any of: build, license, features + +|=== + +=== xpack.usage +[source,js] +---- +client.xpack.usage([params] [, options] [, callback]) +---- +Retrieve information about xpack features usage +[cols=2*] +|=== +|`master_timeout` or `masterTimeout` +|`string` - Specify timeout for watch write operation + +|=== diff --git a/index.d.ts b/index.d.ts index dd7a4244f..0fd8d458d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -134,6 +134,8 @@ declare class Client extends EventEmitter { followInfo: ApiMethod follow_stats: ApiMethod followStats: ApiMethod + forget_follower: ApiMethod + forgetFollower: ApiMethod get_auto_follow_pattern: ApiMethod getAutoFollowPattern: ApiMethod pause_follow: ApiMethod @@ -165,6 +167,38 @@ declare class Client extends EventEmitter { } count: ApiMethod create: ApiMethod + data_frame: { + delete_data_frame_transform: ApiMethod + deleteDataFrameTransform: ApiMethod + get_data_frame_transform: ApiMethod + getDataFrameTransform: ApiMethod + get_data_frame_transform_stats: ApiMethod + getDataFrameTransformStats: ApiMethod + preview_data_frame_transform: ApiMethod + previewDataFrameTransform: ApiMethod + put_data_frame_transform: ApiMethod + putDataFrameTransform: ApiMethod + start_data_frame_transform: ApiMethod + startDataFrameTransform: ApiMethod + stop_data_frame_transform: ApiMethod + stopDataFrameTransform: ApiMethod + } + dataFrame: { + delete_data_frame_transform: ApiMethod + deleteDataFrameTransform: ApiMethod + get_data_frame_transform: ApiMethod + getDataFrameTransform: ApiMethod + get_data_frame_transform_stats: ApiMethod + getDataFrameTransformStats: ApiMethod + preview_data_frame_transform: ApiMethod + previewDataFrameTransform: ApiMethod + put_data_frame_transform: ApiMethod + putDataFrameTransform: ApiMethod + start_data_frame_transform: ApiMethod + startDataFrameTransform: ApiMethod + stop_data_frame_transform: ApiMethod + stopDataFrameTransform: ApiMethod + } delete: ApiMethod delete_by_query: ApiMethod deleteByQuery: ApiMethod @@ -183,6 +217,9 @@ declare class Client extends EventEmitter { getScript: ApiMethod get_source: ApiMethod getSource: ApiMethod + graph: { + explore: ApiMethod + } ilm: { delete_lifecycle: ApiMethod deleteLifecycle: ApiMethod @@ -276,7 +313,23 @@ declare class Client extends EventEmitter { putPipeline: ApiMethod simulate: ApiMethod } + license: { + delete: ApiMethod + get: ApiMethod + get_basic_status: ApiMethod + getBasicStatus: ApiMethod + get_trial_status: ApiMethod + getTrialStatus: ApiMethod + post: ApiMethod + post_start_basic: ApiMethod + postStartBasic: ApiMethod + post_start_trial: ApiMethod + postStartTrial: ApiMethod + } mget: ApiMethod + migration: { + deprecations: ApiMethod + } ml: { close_job: ApiMethod closeJob: ApiMethod @@ -394,6 +447,26 @@ declare class Client extends EventEmitter { reindexRethrottle: ApiMethod render_search_template: ApiMethod renderSearchTemplate: ApiMethod + rollup: { + delete_job: ApiMethod + deleteJob: ApiMethod + get_jobs: ApiMethod + getJobs: ApiMethod + get_rollup_caps: ApiMethod + getRollupCaps: ApiMethod + get_rollup_index_caps: ApiMethod + getRollupIndexCaps: ApiMethod + put_job: ApiMethod + putJob: ApiMethod + rollup_search: ApiMethod + rollupSearch: ApiMethod + start_job: ApiMethod + startJob: ApiMethod + stop_job: ApiMethod + stopJob: ApiMethod + } + scripts_painless_context: ApiMethod + scriptsPainlessContext: ApiMethod scripts_painless_execute: ApiMethod scriptsPainlessExecute: ApiMethod scroll: ApiMethod @@ -468,6 +541,12 @@ declare class Client extends EventEmitter { verify_repository: ApiMethod verifyRepository: ApiMethod } + sql: { + clear_cursor: ApiMethod + clearCursor: ApiMethod + query: ApiMethod + translate: ApiMethod + } ssl: { certificates: ApiMethod } @@ -482,74 +561,28 @@ declare class Client extends EventEmitter { updateByQuery: ApiMethod update_by_query_rethrottle: ApiMethod updateByQueryRethrottle: ApiMethod + watcher: { + ack_watch: ApiMethod + ackWatch: ApiMethod + activate_watch: ApiMethod + activateWatch: ApiMethod + deactivate_watch: ApiMethod + deactivateWatch: ApiMethod + delete_watch: ApiMethod + deleteWatch: ApiMethod + execute_watch: ApiMethod + executeWatch: ApiMethod + get_watch: ApiMethod + getWatch: ApiMethod + put_watch: ApiMethod + putWatch: ApiMethod + start: ApiMethod + stats: ApiMethod + stop: ApiMethod + } xpack: { - graph: { - explore: ApiMethod - } info: ApiMethod - license: { - delete: ApiMethod - get: ApiMethod - get_basic_status: ApiMethod - getBasicStatus: ApiMethod - get_trial_status: ApiMethod - getTrialStatus: ApiMethod - post: ApiMethod - post_start_basic: ApiMethod - postStartBasic: ApiMethod - post_start_trial: ApiMethod - postStartTrial: ApiMethod - } - migration: { - deprecations: ApiMethod - get_assistance: ApiMethod - getAssistance: ApiMethod - upgrade: ApiMethod - } - rollup: { - delete_job: ApiMethod - deleteJob: ApiMethod - get_jobs: ApiMethod - getJobs: ApiMethod - get_rollup_caps: ApiMethod - getRollupCaps: ApiMethod - get_rollup_index_caps: ApiMethod - getRollupIndexCaps: ApiMethod - put_job: ApiMethod - putJob: ApiMethod - rollup_search: ApiMethod - rollupSearch: ApiMethod - start_job: ApiMethod - startJob: ApiMethod - stop_job: ApiMethod - stopJob: ApiMethod - } - sql: { - clear_cursor: ApiMethod - clearCursor: ApiMethod - query: ApiMethod - translate: ApiMethod - } usage: ApiMethod - watcher: { - ack_watch: ApiMethod - ackWatch: ApiMethod - activate_watch: ApiMethod - activateWatch: ApiMethod - deactivate_watch: ApiMethod - deactivateWatch: ApiMethod - delete_watch: ApiMethod - deleteWatch: ApiMethod - execute_watch: ApiMethod - executeWatch: ApiMethod - get_watch: ApiMethod - getWatch: ApiMethod - put_watch: ApiMethod - putWatch: ApiMethod - start: ApiMethod - stats: ApiMethod - stop: ApiMethod - } } } diff --git a/scripts/es-docker-platinum.sh b/scripts/es-docker-platinum.sh index 8ab34962a..9b6b69494 100755 --- a/scripts/es-docker-platinum.sh +++ b/scripts/es-docker-platinum.sh @@ -1,5 +1,9 @@ #!/bin/bash +# Images are cached locally, it may be needed +# to delete an old image and download again +# the latest snapshot. + repo=$(pwd) testnodecrt="/.ci/certs/testnode.crt" testnodekey="/.ci/certs/testnode.key" @@ -28,5 +32,4 @@ exec docker run \ -v "$repo$testnodekey:/usr/share/elasticsearch/config/certs/testnode.key" \ -v "$repo$cacrt:/usr/share/elasticsearch/config/certs/ca.crt" \ -p 9200:9200 \ - docker.elastic.co/elasticsearch/elasticsearch:7.0.0-beta1 - # docker.elastic.co/elasticsearch/elasticsearch:6.6.0 + docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT diff --git a/scripts/es-docker.sh b/scripts/es-docker.sh index d0e4f5adb..b50050389 100755 --- a/scripts/es-docker.sh +++ b/scripts/es-docker.sh @@ -1,5 +1,9 @@ #!/bin/bash +# Images are cached locally, it may be needed +# to delete an old image and download again +# the latest snapshot. + exec docker run \ --rm \ -e "node.attr.testattr=test" \ @@ -9,5 +13,4 @@ exec docker run \ -p 9200:9200 \ --network=elastic \ --name=elasticsearch \ - docker.elastic.co/elasticsearch/elasticsearch:7.0.0-beta1 - # docker.elastic.co/elasticsearch/elasticsearch:6.6.0 + docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT diff --git a/scripts/run.js b/scripts/run.js index 23839c175..df47b783e 100644 --- a/scripts/run.js +++ b/scripts/run.js @@ -35,12 +35,12 @@ const { } = require('./utils') start(minimist(process.argv.slice(2), { - string: ['tag'] + string: ['tag', 'branch'] })) function start (opts) { const log = ora('Loading Elasticsearch Repository').start() - if (semver.valid(opts.tag) === null) { + if (opts.branch == null && semver.valid(opts.tag) === null) { log.fail(`Missing or invalid tag: ${opts.tag}`) return } @@ -55,7 +55,7 @@ function start (opts) { log.text = 'Cleaning API folder...' rimraf.sync(join(apiOutputFolder, '*.js')) - cloneAndCheckout({ log, tag: opts.tag }, (err, { apiFolder, xPackFolder }) => { + cloneAndCheckout({ log, tag: opts.tag, branch: opts.branch }, (err, { apiFolder, xPackFolder }) => { if (err) { log.fail(err.message) return diff --git a/scripts/utils/clone-es.js b/scripts/utils/clone-es.js index 7889541c3..05608eeaa 100644 --- a/scripts/utils/clone-es.js +++ b/scripts/utils/clone-es.js @@ -29,7 +29,7 @@ const apiFolder = join(esFolder, 'rest-api-spec', 'src', 'main', 'resources', 'r const xPackFolder = join(esFolder, 'x-pack', 'plugin', 'src', 'test', 'resources', 'rest-api-spec', 'api') function cloneAndCheckout (opts, callback) { - const { log, tag } = opts + const { log, tag, branch } = opts withTag(tag, callback) /** @@ -57,13 +57,19 @@ function cloneAndCheckout (opts, callback) { if (fresh) { clone(checkout) + } else if (opts.branch) { + checkout(true) } else { checkout() } - function checkout () { - log.text = `Checking out tag '${tag}'` - git.checkout(tag, err => { + function checkout (alsoPull = false) { + if (branch) { + log.text = `Checking out branch '${branch}'` + } else { + log.text = `Checking out tag '${tag}'` + } + git.checkout(branch || tag, err => { if (err) { if (retry++ > 0) { callback(new Error(`Cannot checkout tag '${tag}'`), { apiFolder, xPackFolder }) @@ -71,6 +77,9 @@ function cloneAndCheckout (opts, callback) { } return pull(checkout) } + if (alsoPull) { + return pull(checkout) + } callback(null, { apiFolder, xPackFolder }) }) } diff --git a/test/integration/helper.js b/test/integration/helper.js index 7c9822698..ded90388d 100644 --- a/test/integration/helper.js +++ b/test/integration/helper.js @@ -26,6 +26,8 @@ const esDefaultRoles = [ 'beats_system', 'code_admin', 'code_user', + 'data_frame_transforms_admin', + 'data_frame_transforms_user', 'ingest_admin', 'kibana_dashboard_only_user', 'kibana_system', diff --git a/test/integration/index.js b/test/integration/index.js index e68b5bcf5..328d83b7e 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -49,7 +49,12 @@ const platinumBlackList = { 'indices.get_alias/20_empty.yml': ['Check empty aliases when getting all aliases via /_alias'], // https://github.com/elastic/elasticsearch/pull/39400 'ml/jobs_crud.yml': ['Test put job with id that is already taken'], - // TODO: investigate why this is failing + // it gets random failures on CI, must investigate + 'ml/set_upgrade_mode.yml': [ + 'Attempt to open job when upgrade_mode is enabled', + 'Setting upgrade mode to disabled from enabled' + ], + // investigate why this is failing 'monitoring/bulk/10_basic.yml': ['*'], 'monitoring/bulk/20_privileges.yml': ['*'], 'license/20_put_license.yml': ['*'], @@ -150,7 +155,6 @@ Runner.prototype.start = function (opts) { files.forEach(runTestFile.bind(this)) function runTestFile (file) { - // if (!file.endsWith('watcher/execute_watch/70_invalid.yml')) return for (var i = 0; i < customSkips.length; i++) { if (file.endsWith(customSkips[i])) return } diff --git a/test/integration/test-runner.js b/test/integration/test-runner.js index 63ca22085..d02495264 100644 --- a/test/integration/test-runner.js +++ b/test/integration/test-runner.js @@ -182,15 +182,15 @@ TestRunner.prototype.cleanupPlatinum = function (q, done) { }) q.add((q, done) => { - this.client.xpack.rollup.getJobs({ id: '_all' }, (err, { body }) => { + this.client.rollup.getJobs({ id: '_all' }, (err, { body }) => { this.tap.error(err, 'should not error: rollup.getJobs') const jobs = body.jobs.map(j => j.config.id) helper.runInParallel( - this.client, 'xpack.rollup.stopJob', + this.client, 'rollup.stopJob', jobs.map(j => ({ id: j, waitForCompletion: true })) ) .then(() => helper.runInParallel( - this.client, 'xpack.rollup.deleteJob', + this.client, 'rollup.deleteJob', jobs.map(j => ({ id: j })) )) .then(() => done())