From 3c692c1f6e4c2bbc66e205f43be1c12f0dde6622 Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 14 May 2018 12:01:48 -0700 Subject: [PATCH] [apis] regenerate --- docs/configuration.asciidoc | 2 +- src/lib/apis/0_90.js | 25 ++++ src/lib/apis/6_x.js | 62 +++++++-- src/lib/apis/master.js | 258 ++++++++++++++++++++++++++++-------- 4 files changed, 278 insertions(+), 69 deletions(-) diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index 42c65963d..f7cdfd85d 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -331,7 +331,7 @@ var client = new elasticsearch.Client({ // choose the node with the smallest weight. selection = _(nodes).sortBy(function (node) { return node.host.weight; - }).first(); + }).head(); } return selection; diff --git a/src/lib/apis/0_90.js b/src/lib/apis/0_90.js index 573de1bc4..6ca8a2469 100644 --- a/src/lib/apis/0_90.js +++ b/src/lib/apis/0_90.js @@ -2433,6 +2433,31 @@ api.indices.prototype.stats = ca({ } } }, + { + fmt: '/_stats/<%=metricFamily%>', + req: { + metricFamily: { + type: 'enum', + options: [ + 'completion', + 'docs', + 'fielddata', + 'filter_cache', + 'flush', + 'get', + 'groups', + 'id_cache', + 'ignore_indices', + 'indexing', + 'merge', + 'refresh', + 'search', + 'store', + 'warmer' + ] + } + } + }, { fmt: '/_stats' } diff --git a/src/lib/apis/6_x.js b/src/lib/apis/6_x.js index eacd0d1d1..8ea76c430 100644 --- a/src/lib/apis/6_x.js +++ b/src/lib/apis/6_x.js @@ -3993,6 +3993,7 @@ api.indices.prototype.putMapping = ca({ * * @param {Object} params - An object with parameters used to carry out this action * @param {<>} params.masterTimeout - Specify timeout for connection to master + * @param {<>} params.timeout - Explicit operation timeout * @param {<>} params.preserveExisting - Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false` * @param {<>} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {<>} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) @@ -4006,6 +4007,9 @@ api.indices.prototype.putSettings = ca({ type: 'time', name: 'master_timeout' }, + timeout: { + type: 'time' + }, preserveExisting: { type: 'boolean', name: 'preserve_existing' @@ -4341,6 +4345,7 @@ api.indices.prototype.shardStores = ca({ * Perform a [indices.shrink](https://www.elastic.co/guide/en/elasticsearch/reference/6.x/indices-shrink-index.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.copySettings - whether or not to copy settings from the source index (defaults to false) * @param {<>} params.timeout - Explicit operation timeout * @param {<>} params.masterTimeout - Specify timeout for connection to master * @param {<>} params.waitForActiveShards - Set the number of active shards to wait for on the shrunken index before the operation returns. @@ -4349,6 +4354,10 @@ api.indices.prototype.shardStores = ca({ */ api.indices.prototype.shrink = ca({ params: { + copySettings: { + type: 'boolean', + name: 'copy_settings' + }, timeout: { type: 'time' }, @@ -4379,6 +4388,7 @@ api.indices.prototype.shrink = ca({ * Perform a [indices.split](https://www.elastic.co/guide/en/elasticsearch/reference/6.x/indices-split-index.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.copySettings - whether or not to copy settings from the source index (defaults to false) * @param {<>} params.timeout - Explicit operation timeout * @param {<>} params.masterTimeout - Specify timeout for connection to master * @param {<>} params.waitForActiveShards - Set the number of active shards to wait for on the shrunken index before the operation returns. @@ -4387,6 +4397,10 @@ api.indices.prototype.shrink = ca({ */ api.indices.prototype.split = ca({ params: { + copySettings: { + type: 'boolean', + name: 'copy_settings' + }, timeout: { type: 'time' }, @@ -5622,22 +5636,34 @@ api.putScript = ca({ * Perform a [rankEval](https://www.elastic.co/guide/en/elasticsearch/reference/6.x/search-rank-eval.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {<>} params.allowNoIndices - 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 {<>} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. * @param {<>, <>, <>} params.index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * @param {<>, <>, <>} params.type - A comma-separated list of document types to search; leave empty to perform the operation on all types */ api.rankEval = ca({ - urls: [ - { - fmt: '/<%=index%>/<%=type%>/_rank_eval', - req: { - index: { - type: 'list' - }, - type: { - type: 'list' - } - } + params: { + ignoreUnavailable: { + type: 'boolean', + name: 'ignore_unavailable' }, + allowNoIndices: { + type: 'boolean', + name: 'allow_no_indices' + }, + expandWildcards: { + type: 'enum', + 'default': 'open', + options: [ + 'open', + 'closed', + 'none', + 'all' + ], + name: 'expand_wildcards' + } + }, + urls: [ { fmt: '/<%=index%>/_rank_eval', req: { @@ -5749,6 +5775,18 @@ api.renderSearchTemplate = ca({ method: 'POST' }); +/** + * Perform a [scriptsPainlessExecute](https://www.elastic.co/guide/en/elasticsearch/painless/6.x/painless-execute-api.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + */ +api.scriptsPainlessExecute = ca({ + url: { + fmt: '/_scripts/painless/_execute' + }, + method: 'POST' +}); + /** * Perform a [scroll](https://www.elastic.co/guide/en/elasticsearch/reference/6.x/search-request-scroll.html) request * diff --git a/src/lib/apis/master.js b/src/lib/apis/master.js index 2a8341844..a7bd9ac5a 100644 --- a/src/lib/apis/master.js +++ b/src/lib/apis/master.js @@ -17,12 +17,12 @@ api._namespaces = ['cat', 'cluster', 'indices', 'ingest', 'nodes', 'snapshot', ' * Perform a [bulk](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.includeTypeName - Whether to add the type name to the response * @param {<>} params.waitForActiveShards - Sets the number of shard copies that must be active before proceeding with the bulk 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 {<>} params.refresh - If `true` then refresh the effected 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` (the default) then do nothing with refreshes. * @param {<>} params.routing - Specific routing value * @param {<>} params.timeout - Explicit operation timeout * @param {<>} params.type - Default document type for items which don't provide one - * @param {<>, <>, <>} params.fields - Default comma-separated list of fields to return in the response for updates, can be overridden on each sub-request * @param {<>, <>, <>} params._source - True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request * @param {<>, <>, <>} params._sourceExclude - Default list of fields to exclude from the returned _source field, can be overridden on each sub-request * @param {<>, <>, <>} params._sourceInclude - Default list of fields to extract and return from the _source field, can be overridden on each sub-request @@ -31,6 +31,10 @@ api._namespaces = ['cat', 'cluster', 'indices', 'ingest', 'nodes', 'snapshot', ' */ api.bulk = ca({ params: { + includeTypeName: { + type: 'string', + name: 'include_type_name' + }, waitForActiveShards: { type: 'string', name: 'wait_for_active_shards' @@ -53,9 +57,6 @@ api.bulk = ca({ type: { type: 'string' }, - fields: { - type: 'list' - }, _source: { type: 'list' }, @@ -1816,6 +1817,7 @@ api.create = ca({ * Perform a [delete](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.includeTypeName - Whether to add the type name to the response * @param {<>} params.waitForActiveShards - Sets the number of shard copies that must be active before proceeding with the delete 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 {<>} params.parent - ID of parent document * @param {<>} params.refresh - If `true` then refresh the effected 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` (the default) then do nothing with refreshes. @@ -1829,6 +1831,10 @@ api.create = ca({ */ api['delete'] = ca({ params: { + includeTypeName: { + type: 'string', + name: 'include_type_name' + }, waitForActiveShards: { type: 'string', name: 'wait_for_active_shards' @@ -1865,20 +1871,33 @@ api['delete'] = ca({ name: 'version_type' } }, - url: { - fmt: '/<%=index%>/<%=type%>/<%=id%>', - req: { - index: { - type: 'string' - }, - type: { - type: 'string' - }, - id: { - type: 'string' + urls: [ + { + fmt: '/<%=index%>/<%=type%>/<%=id%>', + req: { + index: { + type: 'string' + }, + type: { + type: 'string' + }, + id: { + type: 'string' + } + } + }, + { + fmt: '/<%=index%>/_doc/<%=id%>', + req: { + index: { + type: 'string' + }, + id: { + type: 'string' + } } } - }, + ], method: 'DELETE' }); @@ -2418,6 +2437,7 @@ api.fieldCaps = ca({ * Perform a [get](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.includeTypeName - Whether to add the type name to the response * @param {<>, <>, <>} params.storedFields - A comma-separated list of stored fields to return in the response * @param {<>} params.parent - The ID of the parent document * @param {<>} params.preference - Specify the node or shard the operation should be performed on (default: random) @@ -2435,6 +2455,10 @@ api.fieldCaps = ca({ */ api.get = ca({ params: { + includeTypeName: { + type: 'string', + name: 'include_type_name' + }, storedFields: { type: 'list', name: 'stored_fields' @@ -2479,20 +2503,33 @@ api.get = ca({ name: 'version_type' } }, - url: { - fmt: '/<%=index%>/<%=type%>/<%=id%>', - req: { - index: { - type: 'string' - }, - type: { - type: 'string' - }, - id: { - type: 'string' + urls: [ + { + fmt: '/<%=index%>/<%=type%>/<%=id%>', + req: { + index: { + type: 'string' + }, + type: { + type: 'string' + }, + id: { + type: 'string' + } + } + }, + { + fmt: '/<%=index%>/_doc/<%=id%>', + req: { + index: { + type: 'string' + }, + id: { + type: 'string' + } } } - } + ] }); /** @@ -2592,6 +2629,7 @@ api.getSource = ca({ * Perform a [index](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.includeTypeName - Whether to add the type name to the response * @param {<>} params.waitForActiveShards - Sets the number of shard copies that must be active before proceeding with the index 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 {<>} [params.opType=index] - Explicit operation type * @param {<>} params.parent - ID of the parent document @@ -2607,6 +2645,10 @@ api.getSource = ca({ */ api.index = ca({ params: { + includeTypeName: { + type: 'string', + name: 'include_type_name' + }, waitForActiveShards: { type: 'string', name: 'wait_for_active_shards' @@ -2680,6 +2722,25 @@ api.index = ca({ type: 'string' } } + }, + { + fmt: '/<%=index%>/_doc/<%=id%>', + req: { + index: { + type: 'string' + }, + id: { + type: 'string' + } + } + }, + { + fmt: '/<%=index%>/_doc', + req: { + index: { + type: 'string' + } + } } ], needBody: true, @@ -2851,6 +2912,7 @@ api.indices.prototype.close = ca({ * Perform a [indices.create](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.includeTypeName - Whether a type should be expected in the body of the mappings. * @param {<>} params.waitForActiveShards - Set the number of active shards to wait for before the operation returns. * @param {<>} params.timeout - Explicit operation timeout * @param {<>} params.masterTimeout - Specify timeout for connection to master @@ -2858,6 +2920,10 @@ api.indices.prototype.close = ca({ */ api.indices.prototype.create = ca({ params: { + includeTypeName: { + type: 'string', + name: 'include_type_name' + }, waitForActiveShards: { type: 'string', name: 'wait_for_active_shards' @@ -3579,6 +3645,7 @@ api.indices.prototype.getFieldMapping = ca({ * Perform a [indices.getMapping](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.includeTypeName - Whether to add the type name to the response * @param {<>} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {<>} params.allowNoIndices - 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 {<>} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. @@ -3588,6 +3655,10 @@ api.indices.prototype.getFieldMapping = ca({ */ api.indices.prototype.getMapping = ca({ params: { + includeTypeName: { + type: 'string', + name: 'include_type_name' + }, ignoreUnavailable: { type: 'boolean', name: 'ignore_unavailable' @@ -3649,6 +3720,7 @@ api.indices.prototype.getMapping = ca({ * Perform a [indices.getSettings](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.masterTimeout - Specify timeout for connection to master * @param {<>} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {<>} params.allowNoIndices - 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 {<>} [params.expandWildcards=open,closed] - Whether to expand wildcard expression to concrete indices that are open, closed or both. @@ -3660,6 +3732,10 @@ api.indices.prototype.getMapping = ca({ */ api.indices.prototype.getSettings = ca({ params: { + masterTimeout: { + type: 'time', + name: 'master_timeout' + }, ignoreUnavailable: { type: 'boolean', name: 'ignore_unavailable' @@ -3906,6 +3982,7 @@ api.indices.prototype.putAlias = ca({ * Perform a [indices.putMapping](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.includeTypeName - Whether a type should be expected in the body of the mappings. * @param {<>} params.timeout - Explicit operation timeout * @param {<>} params.masterTimeout - Specify timeout for connection to master * @param {<>} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -3916,6 +3993,10 @@ api.indices.prototype.putAlias = ca({ */ api.indices.prototype.putMapping = ca({ params: { + includeTypeName: { + type: 'string', + name: 'include_type_name' + }, timeout: { type: 'time' }, @@ -3962,6 +4043,14 @@ api.indices.prototype.putMapping = ca({ type: 'string' } } + }, + { + fmt: '/<%=index%>/_mapping', + req: { + index: { + type: 'list' + } + } } ], needBody: true, @@ -3973,6 +4062,7 @@ api.indices.prototype.putMapping = ca({ * * @param {Object} params - An object with parameters used to carry out this action * @param {<>} params.masterTimeout - Specify timeout for connection to master + * @param {<>} params.timeout - Explicit operation timeout * @param {<>} params.preserveExisting - Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false` * @param {<>} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {<>} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) @@ -3986,6 +4076,9 @@ api.indices.prototype.putSettings = ca({ type: 'time', name: 'master_timeout' }, + timeout: { + type: 'time' + }, preserveExisting: { type: 'boolean', name: 'preserve_existing' @@ -4321,6 +4414,7 @@ api.indices.prototype.shardStores = ca({ * Perform a [indices.shrink](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.copySettings - whether or not to copy settings from the source index (defaults to false) * @param {<>} params.timeout - Explicit operation timeout * @param {<>} params.masterTimeout - Specify timeout for connection to master * @param {<>} params.waitForActiveShards - Set the number of active shards to wait for on the shrunken index before the operation returns. @@ -4329,6 +4423,10 @@ api.indices.prototype.shardStores = ca({ */ api.indices.prototype.shrink = ca({ params: { + copySettings: { + type: 'boolean', + name: 'copy_settings' + }, timeout: { type: 'time' }, @@ -4359,6 +4457,7 @@ api.indices.prototype.shrink = ca({ * Perform a [indices.split](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.copySettings - whether or not to copy settings from the source index (defaults to false) * @param {<>} params.timeout - Explicit operation timeout * @param {<>} params.masterTimeout - Specify timeout for connection to master * @param {<>} params.waitForActiveShards - Set the number of active shards to wait for on the shrunken index before the operation returns. @@ -4367,6 +4466,10 @@ api.indices.prototype.shrink = ca({ */ api.indices.prototype.split = ca({ params: { + copySettings: { + type: 'boolean', + name: 'copy_settings' + }, timeout: { type: 'time' }, @@ -5602,22 +5705,34 @@ api.putScript = ca({ * Perform a [rankEval](https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {<>} params.allowNoIndices - 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 {<>} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. * @param {<>, <>, <>} params.index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * @param {<>, <>, <>} params.type - A comma-separated list of document types to search; leave empty to perform the operation on all types */ api.rankEval = ca({ - urls: [ - { - fmt: '/<%=index%>/<%=type%>/_rank_eval', - req: { - index: { - type: 'list' - }, - type: { - type: 'list' - } - } + params: { + ignoreUnavailable: { + type: 'boolean', + name: 'ignore_unavailable' }, + allowNoIndices: { + type: 'boolean', + name: 'allow_no_indices' + }, + expandWildcards: { + type: 'enum', + 'default': 'open', + options: [ + 'open', + 'closed', + 'none', + 'all' + ], + name: 'expand_wildcards' + } + }, + urls: [ { fmt: '/<%=index%>/_rank_eval', req: { @@ -5729,6 +5844,18 @@ api.renderSearchTemplate = ca({ method: 'POST' }); +/** + * Perform a [scriptsPainlessExecute](https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + */ +api.scriptsPainlessExecute = ca({ + url: { + fmt: '/_scripts/painless/_execute' + }, + method: 'POST' +}); + /** * Perform a [scroll](https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request * @@ -5770,6 +5897,7 @@ api.scroll = ca({ * Perform a [search](https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.includeTypeName - Whether to add the type name to the response * @param {<>} params.analyzer - The analyzer to use for the query string * @param {<>} params.analyzeWildcard - Specify whether wildcard and prefix queries should be analyzed (default: false) * @param {<>} [params.defaultOperator=OR] - The default operator for query string query (AND or OR) @@ -5813,6 +5941,10 @@ api.scroll = ca({ */ api.search = ca({ params: { + includeTypeName: { + type: 'string', + name: 'include_type_name' + }, analyzer: { type: 'string' }, @@ -6703,8 +6835,8 @@ api.termvectors = ca({ * Perform a [update](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html) request * * @param {Object} params - An object with parameters used to carry out this action + * @param {<>} params.includeTypeName - Whether to add the type name to the response * @param {<>} params.waitForActiveShards - Sets the number of shard copies that must be active before proceeding with the update 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 {<>, <>, <>} params.fields - A comma-separated list of fields to return in the response * @param {<>, <>, <>} params._source - True or false to return the _source field or not, or a list of fields to return * @param {<>, <>, <>} params._sourceExclude - A list of fields to exclude from the returned _source field * @param {<>, <>, <>} params._sourceInclude - A list of fields to extract and return from the _source field @@ -6722,13 +6854,14 @@ api.termvectors = ca({ */ api.update = ca({ params: { + includeTypeName: { + type: 'string', + name: 'include_type_name' + }, waitForActiveShards: { type: 'string', name: 'wait_for_active_shards' }, - fields: { - type: 'list' - }, _source: { type: 'list' }, @@ -6777,20 +6910,33 @@ api.update = ca({ name: 'version_type' } }, - url: { - fmt: '/<%=index%>/<%=type%>/<%=id%>/_update', - req: { - index: { - type: 'string' - }, - type: { - type: 'string' - }, - id: { - type: 'string' + urls: [ + { + fmt: '/<%=index%>/<%=type%>/<%=id%>/_update', + req: { + index: { + type: 'string' + }, + type: { + type: 'string' + }, + id: { + type: 'string' + } + } + }, + { + fmt: '/<%=index%>/_doc/<%=id%>/_update', + req: { + index: { + type: 'string' + }, + id: { + type: 'string' + } } } - }, + ], needBody: true, method: 'POST' });