Patch deprecated parameters (#851)
* Updated code generation * API generation * API generation * Updated code generation
This commit is contained in:
committed by
delvedor
parent
b2fbcfd8e2
commit
0efa0df934
@ -52,7 +52,9 @@ function buildBulk (opts) {
|
||||
'fields',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'pipeline',
|
||||
'pretty',
|
||||
'human',
|
||||
@ -64,7 +66,9 @@ function buildBulk (opts) {
|
||||
const snakeCase = {
|
||||
waitForActiveShards: 'wait_for_active_shards',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceInclude: '_source_include',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
@ -29,7 +29,6 @@ function buildDeleteByQuery (opts) {
|
||||
* Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.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
|
||||
* @param {string} analyzer - The analyzer to use for the query string
|
||||
* @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false)
|
||||
* @param {enum} default_operator - The default operator for query string query (AND or OR)
|
||||
@ -86,7 +85,9 @@ function buildDeleteByQuery (opts) {
|
||||
'sort',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'terminate_after',
|
||||
'stats',
|
||||
'version',
|
||||
@ -114,7 +115,9 @@ function buildDeleteByQuery (opts) {
|
||||
searchType: 'search_type',
|
||||
searchTimeout: 'search_timeout',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceInclude: '_source_include',
|
||||
terminateAfter: 'terminate_after',
|
||||
requestCache: 'request_cache',
|
||||
waitForActiveShards: 'wait_for_active_shards',
|
||||
@ -147,12 +150,6 @@ function buildDeleteByQuery (opts) {
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: 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}`)
|
||||
@ -160,7 +157,7 @@ function buildDeleteByQuery (opts) {
|
||||
}
|
||||
|
||||
var warnings = []
|
||||
var { method, body, index, type, ...querystring } = params
|
||||
var { method, body, index, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
if (method == null) {
|
||||
@ -174,11 +171,7 @@ function buildDeleteByQuery (opts) {
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query'
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
|
||||
}
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
|
||||
@ -53,7 +53,9 @@ function buildExists (opts) {
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
@ -66,7 +68,9 @@ function buildExists (opts) {
|
||||
const snakeCase = {
|
||||
storedFields: 'stored_fields',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceInclude: '_source_include',
|
||||
versionType: 'version_type',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
|
||||
@ -51,7 +51,9 @@ function buildExistsSource (opts) {
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
@ -63,7 +65,9 @@ function buildExistsSource (opts) {
|
||||
|
||||
const snakeCase = {
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceInclude: '_source_include',
|
||||
versionType: 'version_type',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
|
||||
@ -60,7 +60,9 @@ function buildExplain (opts) {
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
@ -73,7 +75,9 @@ function buildExplain (opts) {
|
||||
defaultOperator: 'default_operator',
|
||||
storedFields: 'stored_fields',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceInclude: '_source_include',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
@ -55,8 +55,12 @@ function buildGet (opts) {
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
<<<<<<< HEAD
|
||||
'_source_exclude',
|
||||
=======
|
||||
>>>>>>> 844206e... Patch deprecated parameters (#851)
|
||||
'_source_include',
|
||||
'version',
|
||||
'version_type',
|
||||
@ -70,8 +74,12 @@ function buildGet (opts) {
|
||||
const snakeCase = {
|
||||
storedFields: 'stored_fields',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
<<<<<<< HEAD
|
||||
_sourceExclude: '_source_exclude',
|
||||
=======
|
||||
>>>>>>> 844206e... Patch deprecated parameters (#851)
|
||||
_sourceInclude: '_source_include',
|
||||
versionType: 'version_type',
|
||||
errorTrace: 'error_trace',
|
||||
|
||||
@ -51,7 +51,9 @@ function buildGetSource (opts) {
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
@ -63,7 +65,9 @@ function buildGetSource (opts) {
|
||||
|
||||
const snakeCase = {
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceInclude: '_source_include',
|
||||
versionType: 'version_type',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
|
||||
@ -49,7 +49,9 @@ function buildMget (opts) {
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
@ -60,7 +62,9 @@ function buildMget (opts) {
|
||||
const snakeCase = {
|
||||
storedFields: 'stored_fields',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceInclude: '_source_include',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
@ -29,7 +29,6 @@ function buildMsearch (opts) {
|
||||
* Perform a [msearch](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names to use as default
|
||||
* @param {list} type - A comma-separated list of document types to use as default
|
||||
* @param {enum} search_type - Search operation type
|
||||
* @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute
|
||||
* @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response
|
||||
@ -82,12 +81,6 @@ function buildMsearch (opts) {
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: 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}`)
|
||||
@ -95,7 +88,7 @@ function buildMsearch (opts) {
|
||||
}
|
||||
|
||||
var warnings = []
|
||||
var { method, body, index, type, ...querystring } = params
|
||||
var { method, body, index, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
if (method == null) {
|
||||
@ -109,9 +102,7 @@ function buildMsearch (opts) {
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch'
|
||||
} else if ((index) != null) {
|
||||
if ((index) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_msearch'
|
||||
} else {
|
||||
path = '/' + '_msearch'
|
||||
|
||||
@ -29,7 +29,6 @@ function buildMsearchTemplate (opts) {
|
||||
* Perform a [msearch_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names to use as default
|
||||
* @param {list} type - A comma-separated list of document types to use as default
|
||||
* @param {enum} search_type - Search operation type
|
||||
* @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response
|
||||
* @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute
|
||||
@ -76,12 +75,6 @@ function buildMsearchTemplate (opts) {
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: 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}`)
|
||||
@ -89,7 +82,7 @@ function buildMsearchTemplate (opts) {
|
||||
}
|
||||
|
||||
var warnings = []
|
||||
var { method, body, index, type, ...querystring } = params
|
||||
var { method, body, index, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
if (method == null) {
|
||||
@ -103,9 +96,7 @@ function buildMsearchTemplate (opts) {
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' + '/' + 'template'
|
||||
} else if ((index) != null) {
|
||||
if ((index) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template'
|
||||
} else {
|
||||
path = '/' + '_msearch' + '/' + 'template'
|
||||
|
||||
@ -29,7 +29,6 @@ function buildMtermvectors (opts) {
|
||||
* Perform a [mtermvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html) request
|
||||
*
|
||||
* @param {string} index - The index in which the document resides.
|
||||
* @param {string} type - The type of the document.
|
||||
* @param {list} ids - A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body
|
||||
* @param {boolean} term_statistics - Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
|
||||
* @param {boolean} field_statistics - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
|
||||
@ -87,12 +86,6 @@ function buildMtermvectors (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: 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}`)
|
||||
@ -100,7 +93,7 @@ function buildMtermvectors (opts) {
|
||||
}
|
||||
|
||||
var warnings = []
|
||||
var { method, body, index, type, ...querystring } = params
|
||||
var { method, body, index, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
if (method == null) {
|
||||
@ -114,9 +107,7 @@ function buildMtermvectors (opts) {
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mtermvectors'
|
||||
} else if ((index) != null) {
|
||||
if ((index) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors'
|
||||
} else {
|
||||
path = '/' + '_mtermvectors'
|
||||
|
||||
@ -29,7 +29,6 @@ function buildSearch (opts) {
|
||||
* Perform a [search](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.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
|
||||
* @param {string} analyzer - The analyzer to use for the query string
|
||||
* @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false)
|
||||
* @param {enum} default_operator - The default operator for query string query (AND or OR)
|
||||
@ -97,7 +96,9 @@ function buildSearch (opts) {
|
||||
'sort',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'terminate_after',
|
||||
'stats',
|
||||
'suggest_field',
|
||||
@ -134,7 +135,9 @@ function buildSearch (opts) {
|
||||
expandWildcards: 'expand_wildcards',
|
||||
searchType: 'search_type',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceInclude: '_source_include',
|
||||
terminateAfter: 'terminate_after',
|
||||
suggestField: 'suggest_field',
|
||||
suggestMode: 'suggest_mode',
|
||||
@ -166,12 +169,6 @@ function buildSearch (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: 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}`)
|
||||
@ -179,7 +176,7 @@ function buildSearch (opts) {
|
||||
}
|
||||
|
||||
var warnings = []
|
||||
var { method, body, index, type, ...querystring } = params
|
||||
var { method, body, index, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
if (method == null) {
|
||||
@ -193,9 +190,7 @@ function buildSearch (opts) {
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search'
|
||||
} else if ((index) != null) {
|
||||
if ((index) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_search'
|
||||
} else {
|
||||
path = '/' + '_search'
|
||||
|
||||
@ -29,7 +29,6 @@ function buildSearchTemplate (opts) {
|
||||
* Perform a [search_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.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
|
||||
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
||||
* @param {boolean} ignore_throttled - Whether specified concrete, expanded or aliased indices should be ignored when throttled
|
||||
* @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)
|
||||
@ -95,12 +94,6 @@ function buildSearchTemplate (opts) {
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: 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}`)
|
||||
@ -108,7 +101,7 @@ function buildSearchTemplate (opts) {
|
||||
}
|
||||
|
||||
var warnings = []
|
||||
var { method, body, index, type, ...querystring } = params
|
||||
var { method, body, index, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
if (method == null) {
|
||||
@ -122,9 +115,7 @@ function buildSearchTemplate (opts) {
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' + '/' + 'template'
|
||||
} else if ((index) != null) {
|
||||
if ((index) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_search' + '/' + 'template'
|
||||
} else {
|
||||
path = '/' + '_search' + '/' + 'template'
|
||||
|
||||
@ -29,7 +29,6 @@ function buildTermvectors (opts) {
|
||||
* Perform a [termvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html) request
|
||||
*
|
||||
* @param {string} index - The index in which the document resides.
|
||||
* @param {string} type - The type of the document.
|
||||
* @param {string} id - The id of the document, when not specified a doc param should be supplied.
|
||||
* @param {boolean} term_statistics - Specifies if total term frequency and document frequency should be returned.
|
||||
* @param {boolean} field_statistics - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.
|
||||
@ -103,7 +102,7 @@ function buildTermvectors (opts) {
|
||||
}
|
||||
|
||||
var warnings = []
|
||||
var { method, body, index, type, id, ...querystring } = params
|
||||
var { method, body, index, id, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
if (method == null) {
|
||||
@ -117,8 +116,13 @@ function buildTermvectors (opts) {
|
||||
|
||||
var path = ''
|
||||
|
||||
<<<<<<< HEAD
|
||||
if ((index) != null && (type) != null && (id) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_termvectors'
|
||||
=======
|
||||
if ((index) != null && (id) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_termvectors' + '/' + encodeURIComponent(id)
|
||||
>>>>>>> 844206e... Patch deprecated parameters (#851)
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors'
|
||||
}
|
||||
|
||||
@ -54,7 +54,9 @@ function buildUpdate (opts) {
|
||||
'fields',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'lang',
|
||||
'parent',
|
||||
'refresh',
|
||||
@ -75,7 +77,9 @@ function buildUpdate (opts) {
|
||||
const snakeCase = {
|
||||
waitForActiveShards: 'wait_for_active_shards',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceInclude: '_source_include',
|
||||
retryOnConflict: 'retry_on_conflict',
|
||||
ifSeqNo: 'if_seq_no',
|
||||
ifPrimaryTerm: 'if_primary_term',
|
||||
|
||||
@ -29,7 +29,6 @@ function buildUpdateByQuery (opts) {
|
||||
* Perform a [update_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.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
|
||||
* @param {string} analyzer - The analyzer to use for the query string
|
||||
* @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false)
|
||||
* @param {enum} default_operator - The default operator for query string query (AND or OR)
|
||||
@ -89,7 +88,9 @@ function buildUpdateByQuery (opts) {
|
||||
'sort',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_exclude',
|
||||
'_source_includes',
|
||||
'_source_include',
|
||||
'terminate_after',
|
||||
'stats',
|
||||
'version',
|
||||
@ -118,7 +119,9 @@ function buildUpdateByQuery (opts) {
|
||||
searchType: 'search_type',
|
||||
searchTimeout: 'search_timeout',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceInclude: '_source_include',
|
||||
terminateAfter: 'terminate_after',
|
||||
versionType: 'version_type',
|
||||
requestCache: 'request_cache',
|
||||
@ -148,12 +151,6 @@ function buildUpdateByQuery (opts) {
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: 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}`)
|
||||
@ -161,7 +158,7 @@ function buildUpdateByQuery (opts) {
|
||||
}
|
||||
|
||||
var warnings = []
|
||||
var { method, body, index, type, ...querystring } = params
|
||||
var { method, body, index, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
if (method == null) {
|
||||
@ -175,11 +172,7 @@ function buildUpdateByQuery (opts) {
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_update_by_query'
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_update_by_query'
|
||||
}
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_update_by_query'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
|
||||
56
api/requestParams.d.ts
vendored
56
api/requestParams.d.ts
vendored
@ -30,6 +30,8 @@ export interface Generic {
|
||||
export interface Bulk<T = any> extends Generic {
|
||||
index?: string;
|
||||
type?: string;
|
||||
_source_exclude?: string | string[];
|
||||
_source_include?: string | string[];
|
||||
wait_for_active_shards?: string;
|
||||
refresh?: 'true' | 'false' | 'wait_for';
|
||||
routing?: string;
|
||||
@ -386,7 +388,8 @@ export interface Delete extends Generic {
|
||||
|
||||
export interface DeleteByQuery<T = any> extends Generic {
|
||||
index: string | string[];
|
||||
type?: string | string[];
|
||||
_source_exclude?: string | string[];
|
||||
_source_include?: string | string[];
|
||||
analyzer?: string;
|
||||
analyze_wildcard?: boolean;
|
||||
default_operator?: 'AND' | 'OR';
|
||||
@ -436,7 +439,13 @@ export interface DeleteScript extends Generic {
|
||||
export interface Exists extends Generic {
|
||||
id: string;
|
||||
index: string;
|
||||
<<<<<<< HEAD
|
||||
type: string;
|
||||
=======
|
||||
type?: string;
|
||||
_source_exclude?: string | string[];
|
||||
_source_include?: string | string[];
|
||||
>>>>>>> 844206e... Patch deprecated parameters (#851)
|
||||
stored_fields?: string | string[];
|
||||
parent?: string;
|
||||
preference?: string;
|
||||
@ -453,7 +462,13 @@ export interface Exists extends Generic {
|
||||
export interface ExistsSource extends Generic {
|
||||
id: string;
|
||||
index: string;
|
||||
<<<<<<< HEAD
|
||||
type: string;
|
||||
=======
|
||||
type?: string;
|
||||
_source_exclude?: string | string[];
|
||||
_source_include?: string | string[];
|
||||
>>>>>>> 844206e... Patch deprecated parameters (#851)
|
||||
parent?: string;
|
||||
preference?: string;
|
||||
realtime?: boolean;
|
||||
@ -469,7 +484,13 @@ export interface ExistsSource extends Generic {
|
||||
export interface Explain<T = any> extends Generic {
|
||||
id: string;
|
||||
index: string;
|
||||
<<<<<<< HEAD
|
||||
type: string;
|
||||
=======
|
||||
type?: string;
|
||||
_source_exclude?: string | string[];
|
||||
_source_include?: string | string[];
|
||||
>>>>>>> 844206e... Patch deprecated parameters (#851)
|
||||
analyze_wildcard?: boolean;
|
||||
analyzer?: string;
|
||||
default_operator?: 'AND' | 'OR';
|
||||
@ -498,7 +519,13 @@ export interface FieldCaps<T = any> extends Generic {
|
||||
export interface Get extends Generic {
|
||||
id: string;
|
||||
index: string;
|
||||
<<<<<<< HEAD
|
||||
type: string;
|
||||
=======
|
||||
type?: string;
|
||||
_source_exclude?: string | string[];
|
||||
_source_include?: string | string[];
|
||||
>>>>>>> 844206e... Patch deprecated parameters (#851)
|
||||
stored_fields?: string | string[];
|
||||
parent?: string;
|
||||
preference?: string;
|
||||
@ -522,7 +549,13 @@ export interface GetScript extends Generic {
|
||||
export interface GetSource extends Generic {
|
||||
id: string;
|
||||
index: string;
|
||||
<<<<<<< HEAD
|
||||
type: string;
|
||||
=======
|
||||
type?: string;
|
||||
_source_exclude?: string | string[];
|
||||
_source_include?: string | string[];
|
||||
>>>>>>> 844206e... Patch deprecated parameters (#851)
|
||||
parent?: string;
|
||||
preference?: string;
|
||||
realtime?: boolean;
|
||||
@ -936,6 +969,8 @@ export interface IngestSimulate<T = any> extends Generic {
|
||||
export interface Mget<T = any> extends Generic {
|
||||
index?: string;
|
||||
type?: string;
|
||||
_source_exclude?: string | string[];
|
||||
_source_include?: string | string[];
|
||||
stored_fields?: string | string[];
|
||||
preference?: string;
|
||||
realtime?: boolean;
|
||||
@ -949,7 +984,6 @@ export interface Mget<T = any> extends Generic {
|
||||
|
||||
export interface Msearch<T = any> extends Generic {
|
||||
index?: string | string[];
|
||||
type?: string | string[];
|
||||
search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch';
|
||||
max_concurrent_searches?: number;
|
||||
typed_keys?: boolean;
|
||||
@ -961,7 +995,6 @@ export interface Msearch<T = any> extends Generic {
|
||||
|
||||
export interface MsearchTemplate<T = any> extends Generic {
|
||||
index?: string | string[];
|
||||
type?: string | string[];
|
||||
search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch';
|
||||
typed_keys?: boolean;
|
||||
max_concurrent_searches?: number;
|
||||
@ -971,7 +1004,6 @@ export interface MsearchTemplate<T = any> extends Generic {
|
||||
|
||||
export interface Mtermvectors<T = any> extends Generic {
|
||||
index?: string;
|
||||
type?: string;
|
||||
ids?: string | string[];
|
||||
term_statistics?: boolean;
|
||||
field_statistics?: boolean;
|
||||
@ -1082,7 +1114,8 @@ export interface Scroll<T = any> extends Generic {
|
||||
|
||||
export interface Search<T = any> extends Generic {
|
||||
index?: string | string[];
|
||||
type?: string | string[];
|
||||
_source_exclude?: string | string[];
|
||||
_source_include?: string | string[];
|
||||
analyzer?: string;
|
||||
analyze_wildcard?: boolean;
|
||||
default_operator?: 'AND' | 'OR';
|
||||
@ -1139,7 +1172,6 @@ export interface SearchShards extends Generic {
|
||||
|
||||
export interface SearchTemplate<T = any> extends Generic {
|
||||
index?: string | string[];
|
||||
type?: string | string[];
|
||||
ignore_unavailable?: boolean;
|
||||
ignore_throttled?: boolean;
|
||||
allow_no_indices?: boolean;
|
||||
@ -1243,7 +1275,10 @@ export interface TasksList extends Generic {
|
||||
|
||||
export interface Termvectors<T = any> extends Generic {
|
||||
index: string;
|
||||
<<<<<<< HEAD
|
||||
type: string;
|
||||
=======
|
||||
>>>>>>> 844206e... Patch deprecated parameters (#851)
|
||||
id?: string;
|
||||
term_statistics?: boolean;
|
||||
field_statistics?: boolean;
|
||||
@ -1263,7 +1298,13 @@ export interface Termvectors<T = any> extends Generic {
|
||||
export interface Update<T = any> extends Generic {
|
||||
id: string;
|
||||
index: string;
|
||||
<<<<<<< HEAD
|
||||
type: string;
|
||||
=======
|
||||
type?: string;
|
||||
_source_exclude?: string | string[];
|
||||
_source_include?: string | string[];
|
||||
>>>>>>> 844206e... Patch deprecated parameters (#851)
|
||||
wait_for_active_shards?: string;
|
||||
fields?: string | string[];
|
||||
_source?: string | string[];
|
||||
@ -1284,7 +1325,8 @@ export interface Update<T = any> extends Generic {
|
||||
|
||||
export interface UpdateByQuery<T = any> extends Generic {
|
||||
index: string | string[];
|
||||
type?: string | string[];
|
||||
_source_exclude?: string | string[];
|
||||
_source_include?: string | string[];
|
||||
analyzer?: string;
|
||||
analyze_wildcard?: boolean;
|
||||
default_operator?: 'AND' | 'OR';
|
||||
|
||||
@ -1156,9 +1156,6 @@ link:{ref}/docs-delete-by-query.html[Reference]
|
||||
|`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
|
||||
|
||||
|`analyzer`
|
||||
|`string` - The analyzer to use for the query string
|
||||
|
||||
@ -2936,9 +2933,6 @@ link:{ref}/search-multi-search.html[Reference]
|
||||
|`index`
|
||||
|`string, string[]` - A comma-separated list of index names to use as default
|
||||
|
||||
|`type`
|
||||
|`string, string[]` - A comma-separated list of document types to use as default
|
||||
|
||||
|`search_type` or `searchType`
|
||||
|`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type
|
||||
|
||||
@ -2975,9 +2969,6 @@ link:{ref}/search-multi-search.html[Reference]
|
||||
|`index`
|
||||
|`string, string[]` - A comma-separated list of index names to use as default
|
||||
|
||||
|`type`
|
||||
|`string, string[]` - A comma-separated list of document types to use as default
|
||||
|
||||
|`search_type` or `searchType`
|
||||
|`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type
|
||||
|
||||
@ -3006,9 +2997,6 @@ link:{ref}/docs-multi-termvectors.html[Reference]
|
||||
|`index`
|
||||
|`string` - The index in which the document resides.
|
||||
|
||||
|`type`
|
||||
|`string` - The type of the document.
|
||||
|
||||
|`ids`
|
||||
|`string, string[]` - A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body
|
||||
|
||||
@ -3366,9 +3354,6 @@ link:{ref}/search-search.html[Reference]
|
||||
|`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
|
||||
|
||||
|`analyzer`
|
||||
|`string` - The analyzer to use for the query string
|
||||
|
||||
@ -3547,9 +3532,6 @@ link:{ref}/search-template.html[Reference]
|
||||
|`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
|
||||
|
||||
|`ignore_unavailable` or `ignoreUnavailable`
|
||||
|`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
||||
|
||||
@ -3874,9 +3856,6 @@ link:{ref}/docs-termvectors.html[Reference]
|
||||
|`index`
|
||||
|`string` - The index in which the document resides.
|
||||
|
||||
|`type`
|
||||
|`string` - The type of the document.
|
||||
|
||||
|`id`
|
||||
|`string` - The id of the document, when not specified a doc param should be supplied.
|
||||
|
||||
@ -4003,9 +3982,6 @@ link:{ref}/docs-update-by-query.html[Reference]
|
||||
|`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
|
||||
|
||||
|`analyzer`
|
||||
|`string` - The analyzer to use for the query string
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ function start (opts) {
|
||||
|
||||
writeFileSync(
|
||||
requestParamsOutputFile,
|
||||
generateRequestTypes(allSpec),
|
||||
generateRequestTypes(opts.branch || opts.tag, allSpec),
|
||||
{ encoding: 'utf8' }
|
||||
)
|
||||
|
||||
@ -113,7 +113,7 @@ function start (opts) {
|
||||
|
||||
const spec = require(join(apiFolder, file))
|
||||
allSpec.push(spec)
|
||||
const code = generate(spec, common)
|
||||
const code = generate(opts.branch || opts.tag, spec, common)
|
||||
const filePath = join(apiOutputFolder, `${file.slice(0, file.lastIndexOf('.'))}.js`)
|
||||
|
||||
writeFileSync(filePath, code, { encoding: 'utf8' })
|
||||
|
||||
@ -20,11 +20,16 @@
|
||||
'use strict'
|
||||
|
||||
const dedent = require('dedent')
|
||||
const semver = require('semver')
|
||||
const allowedMethods = {
|
||||
noBody: ['GET', 'HEAD', 'DELETE'],
|
||||
body: ['POST', 'PUT', 'DELETE']
|
||||
}
|
||||
|
||||
// if a parameter is depracted in a minor release
|
||||
// we should be able to support it until the next major
|
||||
const deprecatedParameters = require('./patch.json')
|
||||
|
||||
// list of apis that does not need any kind of validation
|
||||
// because of how the url is built or the `type` handling in ES7
|
||||
const noPathValidation = [
|
||||
@ -59,7 +64,8 @@ const ndjsonApi = [
|
||||
'xpack.monitoring.bulk'
|
||||
]
|
||||
|
||||
function generate (spec, common) {
|
||||
function generate (version, spec, common) {
|
||||
const release = semver.valid(version) ? semver.major(version) : version
|
||||
const api = Object.keys(spec)[0]
|
||||
const name = api
|
||||
.replace(/\.([a-z])/g, k => k[1].toUpperCase())
|
||||
@ -80,7 +86,11 @@ function generate (spec, common) {
|
||||
if (params[key].required) {
|
||||
required.push(key)
|
||||
}
|
||||
|
||||
acceptedQuerystring.push(key)
|
||||
if (deprecatedParameters[release] && deprecatedParameters[release][key]) {
|
||||
acceptedQuerystring.push(deprecatedParameters[release][key])
|
||||
}
|
||||
}
|
||||
|
||||
for (const key in spec[api]) {
|
||||
|
||||
@ -19,7 +19,11 @@
|
||||
|
||||
'use strict'
|
||||
|
||||
function generate (api) {
|
||||
const semver = require('semver')
|
||||
const deprecatedParameters = require('./patch.json')
|
||||
|
||||
function generate (version, api) {
|
||||
const release = semver.valid(version) ? semver.major(version) : version
|
||||
var types = `/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
@ -64,9 +68,20 @@ export interface Generic {
|
||||
|
||||
const partsArr = Object.keys(parts)
|
||||
.map(k => ({ key: k, value: parts[k] }))
|
||||
const deprecatedParametersToAdd = []
|
||||
const paramsArr = Object.keys(params)
|
||||
.filter(k => !Object.keys(parts).includes(k))
|
||||
.map(k => ({ key: k, value: params[k] }))
|
||||
.map(k => {
|
||||
if (deprecatedParameters[release] && deprecatedParameters[release][k]) {
|
||||
deprecatedParametersToAdd.push({
|
||||
key: deprecatedParameters[release][k],
|
||||
value: params[k]
|
||||
})
|
||||
}
|
||||
return { key: k, value: params[k] }
|
||||
})
|
||||
|
||||
deprecatedParametersToAdd.forEach(k => partsArr.push(k))
|
||||
|
||||
const genLine = e => {
|
||||
const optional = e.value.required ? '' : '?'
|
||||
|
||||
14
scripts/utils/patch.json
Normal file
14
scripts/utils/patch.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"6": {
|
||||
"_source_includes": "_source_include",
|
||||
"_source_excludes": "_source_exclude"
|
||||
},
|
||||
"7": {
|
||||
"_source_includes": "_source_include",
|
||||
"_source_excludes": "_source_exclude"
|
||||
},
|
||||
"master": {
|
||||
"_source_includes": "_source_include",
|
||||
"_source_excludes": "_source_exclude"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user