Skip to content

Patch deprecated parameters #851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/api/bulk.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ function buildBulk (opts) {
'type',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'pipeline',
'pretty',
'human',
Expand All @@ -62,7 +64,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'
}
Expand Down
19 changes: 6 additions & 13 deletions api/api/delete_by_query.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -86,7 +85,9 @@ function buildDeleteByQuery (opts) {
'sort',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'terminate_after',
'stats',
'version',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -147,20 +150,14 @@ 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}`)
return handleError(err, callback)
}

var warnings = []
var { method, body, index, type, ...querystring } = params
var { method, body, index, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

if (method == null) {
Expand All @@ -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 = {
Expand Down
4 changes: 4 additions & 0 deletions api/api/exists.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ function buildExists (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'version',
'version_type',
'pretty',
Expand All @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions api/api/exists_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ function buildExistsSource (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'version',
'version_type',
'pretty',
Expand All @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions api/api/explain.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ function buildExplain (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'pretty',
'human',
'error_trace',
Expand All @@ -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'
}
Expand Down
4 changes: 4 additions & 0 deletions api/api/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ function buildGet (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'version',
'version_type',
'pretty',
Expand All @@ -66,7 +68,9 @@ function buildGet (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'
Expand Down
4 changes: 4 additions & 0 deletions api/api/get_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ function buildGetSource (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'version',
'version_type',
'pretty',
Expand All @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions api/api/mget.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ function buildMget (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'pretty',
'human',
'error_trace',
Expand All @@ -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'
}
Expand Down
13 changes: 2 additions & 11 deletions api/api/msearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -85,20 +84,14 @@ 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}`)
return handleError(err, callback)
}

var warnings = []
var { method, body, index, type, ...querystring } = params
var { method, body, index, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

if (method == null) {
Expand All @@ -112,9 +105,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'
Expand Down
13 changes: 2 additions & 11 deletions api/api/msearch_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -79,20 +78,14 @@ 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}`)
return handleError(err, callback)
}

var warnings = []
var { method, body, index, type, ...querystring } = params
var { method, body, index, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

if (method == null) {
Expand All @@ -106,9 +99,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'
Expand Down
13 changes: 2 additions & 11 deletions api/api/mtermvectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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".
Expand Down Expand Up @@ -87,20 +86,14 @@ 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}`)
return handleError(err, callback)
}

var warnings = []
var { method, body, index, type, ...querystring } = params
var { method, body, index, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

if (method == null) {
Expand All @@ -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'
Expand Down
17 changes: 6 additions & 11 deletions api/api/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
Expand Down Expand Up @@ -99,7 +98,9 @@ function buildSearch (opts) {
'sort',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'terminate_after',
'stats',
'suggest_field',
Expand Down Expand Up @@ -137,7 +138,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',
Expand Down Expand Up @@ -169,20 +172,14 @@ 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}`)
return handleError(err, callback)
}

var warnings = []
var { method, body, index, type, ...querystring } = params
var { method, body, index, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

if (method == null) {
Expand All @@ -196,9 +193,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'
Expand Down
Loading