API generation

This commit is contained in:
delvedor
2019-05-16 16:56:01 -04:00
parent c68a5ce9a2
commit f8034c60bc
18 changed files with 108 additions and 207 deletions

View File

@ -51,13 +51,7 @@ function buildBulk (opts) {
'type', 'type',
'fields', 'fields',
'_source', '_source',
<<<<<<< HEAD
'_source_exclude', '_source_exclude',
=======
'_source_excludes',
'_source_exclude',
'_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
'_source_include', '_source_include',
'pipeline', 'pipeline',
'pretty', 'pretty',
@ -69,13 +63,7 @@ function buildBulk (opts) {
const snakeCase = { const snakeCase = {
waitForActiveShards: 'wait_for_active_shards', waitForActiveShards: 'wait_for_active_shards',
<<<<<<< HEAD
_sourceExclude: '_source_exclude', _sourceExclude: '_source_exclude',
=======
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
_sourceInclude: '_source_include', _sourceInclude: '_source_include',
errorTrace: 'error_trace', errorTrace: 'error_trace',
filterPath: 'filter_path' filterPath: 'filter_path'

View File

@ -29,6 +29,7 @@ function buildDeleteByQuery (opts) {
* Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-delete-by-query.html) request * Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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} 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 {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} 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) * @param {enum} default_operator - The default operator for query string query (AND or OR)
@ -84,13 +85,7 @@ function buildDeleteByQuery (opts) {
'size', 'size',
'sort', 'sort',
'_source', '_source',
<<<<<<< HEAD
'_source_exclude', '_source_exclude',
=======
'_source_excludes',
'_source_exclude',
'_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
'_source_include', '_source_include',
'terminate_after', 'terminate_after',
'stats', 'stats',
@ -118,13 +113,7 @@ function buildDeleteByQuery (opts) {
expandWildcards: 'expand_wildcards', expandWildcards: 'expand_wildcards',
searchType: 'search_type', searchType: 'search_type',
searchTimeout: 'search_timeout', searchTimeout: 'search_timeout',
<<<<<<< HEAD
_sourceExclude: '_source_exclude', _sourceExclude: '_source_exclude',
=======
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
_sourceInclude: '_source_include', _sourceInclude: '_source_include',
terminateAfter: 'terminate_after', terminateAfter: 'terminate_after',
requestCache: 'request_cache', requestCache: 'request_cache',
@ -158,6 +147,12 @@ function buildDeleteByQuery (opts) {
return handleError(err, callback) 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 // validate headers object
if (options.headers != null && typeof options.headers !== 'object') { if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@ -165,7 +160,7 @@ function buildDeleteByQuery (opts) {
} }
var warnings = [] var warnings = []
var { method, body, index, ...querystring } = params var { method, body, index, type, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) { if (method == null) {
@ -179,7 +174,11 @@ function buildDeleteByQuery (opts) {
var path = '' var path = ''
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query' if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
}
// build request object // build request object
const request = { const request = {

View File

@ -52,13 +52,7 @@ function buildExists (opts) {
'refresh', 'refresh',
'routing', 'routing',
'_source', '_source',
<<<<<<< HEAD
'_source_exclude', '_source_exclude',
=======
'_source_excludes',
'_source_exclude',
'_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
'_source_include', '_source_include',
'version', 'version',
'version_type', 'version_type',
@ -71,13 +65,7 @@ function buildExists (opts) {
const snakeCase = { const snakeCase = {
storedFields: 'stored_fields', storedFields: 'stored_fields',
<<<<<<< HEAD
_sourceExclude: '_source_exclude', _sourceExclude: '_source_exclude',
=======
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
_sourceInclude: '_source_include', _sourceInclude: '_source_include',
versionType: 'version_type', versionType: 'version_type',
errorTrace: 'error_trace', errorTrace: 'error_trace',

View File

@ -50,13 +50,7 @@ function buildExistsSource (opts) {
'refresh', 'refresh',
'routing', 'routing',
'_source', '_source',
<<<<<<< HEAD
'_source_exclude', '_source_exclude',
=======
'_source_excludes',
'_source_exclude',
'_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
'_source_include', '_source_include',
'version', 'version',
'version_type', 'version_type',
@ -68,13 +62,7 @@ function buildExistsSource (opts) {
] ]
const snakeCase = { const snakeCase = {
<<<<<<< HEAD
_sourceExclude: '_source_exclude', _sourceExclude: '_source_exclude',
=======
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
_sourceInclude: '_source_include', _sourceInclude: '_source_include',
versionType: 'version_type', versionType: 'version_type',
errorTrace: 'error_trace', errorTrace: 'error_trace',

View File

@ -59,13 +59,7 @@ function buildExplain (opts) {
'q', 'q',
'routing', 'routing',
'_source', '_source',
<<<<<<< HEAD
'_source_exclude', '_source_exclude',
=======
'_source_excludes',
'_source_exclude',
'_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
'_source_include', '_source_include',
'pretty', 'pretty',
'human', 'human',
@ -78,13 +72,7 @@ function buildExplain (opts) {
analyzeWildcard: 'analyze_wildcard', analyzeWildcard: 'analyze_wildcard',
defaultOperator: 'default_operator', defaultOperator: 'default_operator',
storedFields: 'stored_fields', storedFields: 'stored_fields',
<<<<<<< HEAD
_sourceExclude: '_source_exclude', _sourceExclude: '_source_exclude',
=======
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
_sourceInclude: '_source_include', _sourceInclude: '_source_include',
errorTrace: 'error_trace', errorTrace: 'error_trace',
filterPath: 'filter_path' filterPath: 'filter_path'

View File

@ -52,13 +52,7 @@ function buildGet (opts) {
'refresh', 'refresh',
'routing', 'routing',
'_source', '_source',
<<<<<<< HEAD
'_source_exclude', '_source_exclude',
=======
'_source_excludes',
'_source_exclude',
'_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
'_source_include', '_source_include',
'version', 'version',
'version_type', 'version_type',
@ -71,13 +65,7 @@ function buildGet (opts) {
const snakeCase = { const snakeCase = {
storedFields: 'stored_fields', storedFields: 'stored_fields',
<<<<<<< HEAD
_sourceExclude: '_source_exclude', _sourceExclude: '_source_exclude',
=======
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
_sourceInclude: '_source_include', _sourceInclude: '_source_include',
versionType: 'version_type', versionType: 'version_type',
errorTrace: 'error_trace', errorTrace: 'error_trace',

View File

@ -50,13 +50,7 @@ function buildGetSource (opts) {
'refresh', 'refresh',
'routing', 'routing',
'_source', '_source',
<<<<<<< HEAD
'_source_exclude', '_source_exclude',
=======
'_source_excludes',
'_source_exclude',
'_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
'_source_include', '_source_include',
'version', 'version',
'version_type', 'version_type',
@ -68,13 +62,7 @@ function buildGetSource (opts) {
] ]
const snakeCase = { const snakeCase = {
<<<<<<< HEAD
_sourceExclude: '_source_exclude', _sourceExclude: '_source_exclude',
=======
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
_sourceInclude: '_source_include', _sourceInclude: '_source_include',
versionType: 'version_type', versionType: 'version_type',
errorTrace: 'error_trace', errorTrace: 'error_trace',

View File

@ -48,13 +48,7 @@ function buildMget (opts) {
'refresh', 'refresh',
'routing', 'routing',
'_source', '_source',
<<<<<<< HEAD
'_source_exclude', '_source_exclude',
=======
'_source_excludes',
'_source_exclude',
'_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
'_source_include', '_source_include',
'pretty', 'pretty',
'human', 'human',
@ -65,13 +59,7 @@ function buildMget (opts) {
const snakeCase = { const snakeCase = {
storedFields: 'stored_fields', storedFields: 'stored_fields',
<<<<<<< HEAD
_sourceExclude: '_source_exclude', _sourceExclude: '_source_exclude',
=======
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
_sourceInclude: '_source_include', _sourceInclude: '_source_include',
errorTrace: 'error_trace', errorTrace: 'error_trace',
filterPath: 'filter_path' filterPath: 'filter_path'

View File

@ -29,6 +29,7 @@ function buildMsearch (opts) {
* Perform a [msearch](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-multi-search.html) request * Perform a [msearch](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-multi-search.html) request
* *
* @param {list} index - A comma-separated list of index names to use as default * @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 {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 {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 * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response
@ -75,6 +76,12 @@ function buildMsearch (opts) {
return handleError(err, callback) 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 // validate headers object
if (options.headers != null && typeof options.headers !== 'object') { if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@ -82,7 +89,7 @@ function buildMsearch (opts) {
} }
var warnings = [] var warnings = []
var { method, body, index, ...querystring } = params var { method, body, index, type, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) { if (method == null) {
@ -96,7 +103,9 @@ function buildMsearch (opts) {
var path = '' var path = ''
if ((index) != null) { if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_msearch' path = '/' + encodeURIComponent(index) + '/' + '_msearch'
} else { } else {
path = '/' + '_msearch' path = '/' + '_msearch'

View File

@ -29,6 +29,7 @@ function buildMsearchTemplate (opts) {
* Perform a [msearch_template](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) request * Perform a [msearch_template](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) request
* *
* @param {list} index - A comma-separated list of index names to use as default * @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 {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 {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 * @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute
@ -72,6 +73,12 @@ function buildMsearchTemplate (opts) {
return handleError(err, callback) 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 // validate headers object
if (options.headers != null && typeof options.headers !== 'object') { if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@ -79,7 +86,7 @@ function buildMsearchTemplate (opts) {
} }
var warnings = [] var warnings = []
var { method, body, index, ...querystring } = params var { method, body, index, type, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) { if (method == null) {
@ -93,7 +100,9 @@ function buildMsearchTemplate (opts) {
var path = '' var path = ''
if ((index) != null) { if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' + '/' + 'template'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template' path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template'
} else { } else {
path = '/' + '_msearch' + '/' + 'template' path = '/' + '_msearch' + '/' + 'template'

View File

@ -29,6 +29,7 @@ function buildMtermvectors (opts) {
* Perform a [mtermvectors](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-multi-termvectors.html) request * Perform a [mtermvectors](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-multi-termvectors.html) request
* *
* @param {string} index - The index in which the document resides. * @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 {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} 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". * @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".
@ -86,6 +87,12 @@ function buildMtermvectors (opts) {
options = {} 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 // validate headers object
if (options.headers != null && typeof options.headers !== 'object') { if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@ -93,7 +100,7 @@ function buildMtermvectors (opts) {
} }
var warnings = [] var warnings = []
var { method, body, index, ...querystring } = params var { method, body, index, type, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) { if (method == null) {
@ -107,7 +114,9 @@ function buildMtermvectors (opts) {
var path = '' var path = ''
if ((index) != null) { if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mtermvectors'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors' path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors'
} else { } else {
path = '/' + '_mtermvectors' path = '/' + '_mtermvectors'

View File

@ -29,6 +29,7 @@ function buildSearch (opts) {
* Perform a [search](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-search.html) request * Perform a [search](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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} 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 {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} 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) * @param {enum} default_operator - The default operator for query string query (AND or OR)
@ -91,13 +92,7 @@ function buildSearch (opts) {
'size', 'size',
'sort', 'sort',
'_source', '_source',
<<<<<<< HEAD
'_source_exclude', '_source_exclude',
=======
'_source_excludes',
'_source_exclude',
'_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
'_source_include', '_source_include',
'terminate_after', 'terminate_after',
'stats', 'stats',
@ -130,13 +125,7 @@ function buildSearch (opts) {
allowNoIndices: 'allow_no_indices', allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards', expandWildcards: 'expand_wildcards',
searchType: 'search_type', searchType: 'search_type',
<<<<<<< HEAD
_sourceExclude: '_source_exclude', _sourceExclude: '_source_exclude',
=======
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
_sourceInclude: '_source_include', _sourceInclude: '_source_include',
terminateAfter: 'terminate_after', terminateAfter: 'terminate_after',
suggestField: 'suggest_field', suggestField: 'suggest_field',
@ -165,6 +154,12 @@ function buildSearch (opts) {
options = {} 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 // validate headers object
if (options.headers != null && typeof options.headers !== 'object') { if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@ -172,7 +167,7 @@ function buildSearch (opts) {
} }
var warnings = [] var warnings = []
var { method, body, index, ...querystring } = params var { method, body, index, type, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) { if (method == null) {
@ -186,7 +181,9 @@ function buildSearch (opts) {
var path = '' var path = ''
if ((index) != null) { if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_search' path = '/' + encodeURIComponent(index) + '/' + '_search'
} else { } else {
path = '/' + '_search' path = '/' + '_search'

View File

@ -29,6 +29,7 @@ function buildSearchTemplate (opts) {
* Perform a [search_template](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) request * Perform a [search_template](https://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} 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_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 {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 {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
@ -82,15 +83,9 @@ function buildSearchTemplate (opts) {
options = {} options = {}
} }
<<<<<<< HEAD
// check required url components // check required url components
if (params['type'] != null && (params['index'] == null)) { if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index') const err = new ConfigurationError('Missing required parameter of the url: index')
=======
// check required parameters
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
>>>>>>> 844206e... Patch deprecated parameters (#851)
return handleError(err, callback) return handleError(err, callback)
} }
@ -101,7 +96,7 @@ function buildSearchTemplate (opts) {
} }
var warnings = [] var warnings = []
var { method, body, index, ...querystring } = params var { method, body, index, type, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) { if (method == null) {
@ -115,7 +110,9 @@ function buildSearchTemplate (opts) {
var path = '' var path = ''
if ((index) != null) { if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' + '/' + 'template'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_search' + '/' + 'template' path = '/' + encodeURIComponent(index) + '/' + '_search' + '/' + 'template'
} else { } else {
path = '/' + '_search' + '/' + 'template' path = '/' + '_search' + '/' + 'template'

View File

@ -29,6 +29,7 @@ function buildTermvectors (opts) {
* Perform a [termvectors](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-termvectors.html) request * Perform a [termvectors](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-termvectors.html) request
* *
* @param {string} index - The index in which the document resides. * @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 {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} 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. * @param {boolean} field_statistics - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.
@ -102,7 +103,7 @@ function buildTermvectors (opts) {
} }
var warnings = [] var warnings = []
var { method, body, index, id, ...querystring } = params var { method, body, index, type, id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) { if (method == null) {
@ -116,13 +117,8 @@ function buildTermvectors (opts) {
var path = '' var path = ''
<<<<<<< HEAD
if ((index) != null && (type) != null && (id) != null) { if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_termvectors' 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 { } else {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors' path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors'
} }

View File

@ -53,13 +53,7 @@ function buildUpdate (opts) {
'wait_for_active_shards', 'wait_for_active_shards',
'fields', 'fields',
'_source', '_source',
<<<<<<< HEAD
'_source_exclude', '_source_exclude',
=======
'_source_excludes',
'_source_exclude',
'_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
'_source_include', '_source_include',
'lang', 'lang',
'parent', 'parent',
@ -80,13 +74,7 @@ function buildUpdate (opts) {
const snakeCase = { const snakeCase = {
waitForActiveShards: 'wait_for_active_shards', waitForActiveShards: 'wait_for_active_shards',
<<<<<<< HEAD
_sourceExclude: '_source_exclude', _sourceExclude: '_source_exclude',
=======
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
_sourceInclude: '_source_include', _sourceInclude: '_source_include',
retryOnConflict: 'retry_on_conflict', retryOnConflict: 'retry_on_conflict',
versionType: 'version_type', versionType: 'version_type',

View File

@ -29,6 +29,7 @@ function buildUpdateByQuery (opts) {
* Perform a [update_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-update-by-query.html) request * Perform a [update_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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} 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 {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} 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) * @param {enum} default_operator - The default operator for query string query (AND or OR)
@ -87,13 +88,7 @@ function buildUpdateByQuery (opts) {
'size', 'size',
'sort', 'sort',
'_source', '_source',
<<<<<<< HEAD
'_source_exclude', '_source_exclude',
=======
'_source_excludes',
'_source_exclude',
'_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
'_source_include', '_source_include',
'terminate_after', 'terminate_after',
'stats', 'stats',
@ -122,13 +117,7 @@ function buildUpdateByQuery (opts) {
expandWildcards: 'expand_wildcards', expandWildcards: 'expand_wildcards',
searchType: 'search_type', searchType: 'search_type',
searchTimeout: 'search_timeout', searchTimeout: 'search_timeout',
<<<<<<< HEAD
_sourceExclude: '_source_exclude', _sourceExclude: '_source_exclude',
=======
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
>>>>>>> 844206e... Patch deprecated parameters (#851)
_sourceInclude: '_source_include', _sourceInclude: '_source_include',
terminateAfter: 'terminate_after', terminateAfter: 'terminate_after',
versionType: 'version_type', versionType: 'version_type',
@ -159,6 +148,12 @@ function buildUpdateByQuery (opts) {
return handleError(err, callback) 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 // validate headers object
if (options.headers != null && typeof options.headers !== 'object') { if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@ -166,7 +161,7 @@ function buildUpdateByQuery (opts) {
} }
var warnings = [] var warnings = []
var { method, body, index, ...querystring } = params var { method, body, index, type, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) { if (method == null) {
@ -180,7 +175,11 @@ function buildUpdateByQuery (opts) {
var path = '' var path = ''
path = '/' + encodeURIComponent(index) + '/' + '_update_by_query' if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_update_by_query'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_update_by_query'
}
// build request object // build request object
const request = { const request = {

View File

@ -30,8 +30,6 @@ export interface Generic {
export interface Bulk<T = any> extends Generic { export interface Bulk<T = any> extends Generic {
index?: string; index?: string;
type?: string; type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
wait_for_active_shards?: string; wait_for_active_shards?: string;
refresh?: 'true' | 'false' | 'wait_for'; refresh?: 'true' | 'false' | 'wait_for';
routing?: string; routing?: string;
@ -401,8 +399,7 @@ export interface Delete extends Generic {
export interface DeleteByQuery<T = any> extends Generic { export interface DeleteByQuery<T = any> extends Generic {
index: string | string[]; index: string | string[];
_source_exclude?: string | string[]; type?: string | string[];
_source_include?: string | string[];
analyzer?: string; analyzer?: string;
analyze_wildcard?: boolean; analyze_wildcard?: boolean;
default_operator?: 'AND' | 'OR'; default_operator?: 'AND' | 'OR';
@ -452,13 +449,7 @@ export interface DeleteTemplate extends Generic {
export interface Exists extends Generic { export interface Exists extends Generic {
id: string; id: string;
index: string; index: string;
<<<<<<< HEAD
type: string; type: string;
=======
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
>>>>>>> 844206e... Patch deprecated parameters (#851)
stored_fields?: string | string[]; stored_fields?: string | string[];
parent?: string; parent?: string;
preference?: string; preference?: string;
@ -475,13 +466,7 @@ export interface Exists extends Generic {
export interface ExistsSource extends Generic { export interface ExistsSource extends Generic {
id: string; id: string;
index: string; index: string;
<<<<<<< HEAD
type: string; type: string;
=======
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
>>>>>>> 844206e... Patch deprecated parameters (#851)
parent?: string; parent?: string;
preference?: string; preference?: string;
realtime?: boolean; realtime?: boolean;
@ -497,13 +482,7 @@ export interface ExistsSource extends Generic {
export interface Explain<T = any> extends Generic { export interface Explain<T = any> extends Generic {
id: string; id: string;
index: string; index: string;
<<<<<<< HEAD
type: string; type: string;
=======
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
>>>>>>> 844206e... Patch deprecated parameters (#851)
analyze_wildcard?: boolean; analyze_wildcard?: boolean;
analyzer?: string; analyzer?: string;
default_operator?: 'AND' | 'OR'; default_operator?: 'AND' | 'OR';
@ -542,13 +521,7 @@ export interface FieldStats<T = any> extends Generic {
export interface Get extends Generic { export interface Get extends Generic {
id: string; id: string;
index: string; index: string;
<<<<<<< HEAD
type: string; type: string;
=======
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
>>>>>>> 844206e... Patch deprecated parameters (#851)
stored_fields?: string | string[]; stored_fields?: string | string[];
parent?: string; parent?: string;
preference?: string; preference?: string;
@ -570,13 +543,7 @@ export interface GetScript extends Generic {
export interface GetSource extends Generic { export interface GetSource extends Generic {
id: string; id: string;
index: string; index: string;
<<<<<<< HEAD
type: string; type: string;
=======
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
>>>>>>> 844206e... Patch deprecated parameters (#851)
parent?: string; parent?: string;
preference?: string; preference?: string;
realtime?: boolean; realtime?: boolean;
@ -984,8 +951,6 @@ export interface IngestSimulate<T = any> extends Generic {
export interface Mget<T = any> extends Generic { export interface Mget<T = any> extends Generic {
index?: string; index?: string;
type?: string; type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
stored_fields?: string | string[]; stored_fields?: string | string[];
preference?: string; preference?: string;
realtime?: boolean; realtime?: boolean;
@ -1008,6 +973,7 @@ export interface Mpercolate<T = any> extends Generic {
export interface Msearch<T = any> extends Generic { export interface Msearch<T = any> extends Generic {
index?: string | string[]; index?: string | string[];
type?: string | string[];
search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch'; search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch';
max_concurrent_searches?: number; max_concurrent_searches?: number;
typed_keys?: boolean; typed_keys?: boolean;
@ -1017,6 +983,7 @@ export interface Msearch<T = any> extends Generic {
export interface MsearchTemplate<T = any> extends Generic { export interface MsearchTemplate<T = any> extends Generic {
index?: string | string[]; index?: string | string[];
type?: string | string[];
search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch'; search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch';
typed_keys?: boolean; typed_keys?: boolean;
max_concurrent_searches?: number; max_concurrent_searches?: number;
@ -1025,6 +992,7 @@ export interface MsearchTemplate<T = any> extends Generic {
export interface Mtermvectors<T = any> extends Generic { export interface Mtermvectors<T = any> extends Generic {
index?: string; index?: string;
type?: string;
ids?: string | string[]; ids?: string | string[];
term_statistics?: boolean; term_statistics?: boolean;
field_statistics?: boolean; field_statistics?: boolean;
@ -1135,8 +1103,7 @@ export interface Scroll<T = any> extends Generic {
export interface Search<T = any> extends Generic { export interface Search<T = any> extends Generic {
index?: string | string[]; index?: string | string[];
_source_exclude?: string | string[]; type?: string | string[];
_source_include?: string | string[];
analyzer?: string; analyzer?: string;
analyze_wildcard?: boolean; analyze_wildcard?: boolean;
default_operator?: 'AND' | 'OR'; default_operator?: 'AND' | 'OR';
@ -1190,6 +1157,7 @@ export interface SearchShards extends Generic {
export interface SearchTemplate<T = any> extends Generic { export interface SearchTemplate<T = any> extends Generic {
index?: string | string[]; index?: string | string[];
type?: string | string[];
ignore_unavailable?: boolean; ignore_unavailable?: boolean;
allow_no_indices?: boolean; allow_no_indices?: boolean;
expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; expand_wildcards?: 'open' | 'closed' | 'none' | 'all';
@ -1301,10 +1269,7 @@ export interface TasksList extends Generic {
export interface Termvectors<T = any> extends Generic { export interface Termvectors<T = any> extends Generic {
index: string; index: string;
<<<<<<< HEAD
type: string; type: string;
=======
>>>>>>> 844206e... Patch deprecated parameters (#851)
id?: string; id?: string;
term_statistics?: boolean; term_statistics?: boolean;
field_statistics?: boolean; field_statistics?: boolean;
@ -1324,13 +1289,7 @@ export interface Termvectors<T = any> extends Generic {
export interface Update<T = any> extends Generic { export interface Update<T = any> extends Generic {
id: string; id: string;
index: string; index: string;
<<<<<<< HEAD
type: string; type: string;
=======
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
>>>>>>> 844206e... Patch deprecated parameters (#851)
wait_for_active_shards?: string; wait_for_active_shards?: string;
fields?: string | string[]; fields?: string | string[];
_source?: string | string[]; _source?: string | string[];
@ -1351,8 +1310,7 @@ export interface Update<T = any> extends Generic {
export interface UpdateByQuery<T = any> extends Generic { export interface UpdateByQuery<T = any> extends Generic {
index: string | string[]; index: string | string[];
_source_exclude?: string | string[]; type?: string | string[];
_source_include?: string | string[];
analyzer?: string; analyzer?: string;
analyze_wildcard?: boolean; analyze_wildcard?: boolean;
default_operator?: 'AND' | 'OR'; default_operator?: 'AND' | 'OR';

View File

@ -1197,6 +1197,9 @@ link:{ref}/docs-delete-by-query.html[Reference]
|`index` |`index`
|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`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` |`analyzer`
|`string` - The analyzer to use for the query string |`string` - The analyzer to use for the query string
@ -3012,6 +3015,9 @@ link:{ref}/search-multi-search.html[Reference]
|`index` |`index`
|`string, string[]` - A comma-separated list of index names to use as default |`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` |`search_type` or `searchType`
|`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type |`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type
@ -3041,6 +3047,9 @@ link:{ref}/search-template.html[Reference]
|`index` |`index`
|`string, string[]` - A comma-separated list of index names to use as default |`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` |`search_type` or `searchType`
|`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type |`'query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch'` - Search operation type
@ -3066,6 +3075,9 @@ link:{ref}/docs-multi-termvectors.html[Reference]
|`index` |`index`
|`string` - The index in which the document resides. |`string` - The index in which the document resides.
|`type`
|`string` - The type of the document.
|`ids` |`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 |`string, string[]` - A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body
@ -3418,6 +3430,9 @@ link:{ref}/search-search.html[Reference]
|`index` |`index`
|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`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` |`analyzer`
|`string` - The analyzer to use for the query string |`string` - The analyzer to use for the query string
@ -3586,6 +3601,9 @@ link:{ref}/search-template.html[Reference]
|`index` |`index`
|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`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` |`ignore_unavailable` or `ignoreUnavailable`
|`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed) |`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed)
@ -3936,6 +3954,9 @@ link:{ref}/docs-termvectors.html[Reference]
|`index` |`index`
|`string` - The index in which the document resides. |`string` - The index in which the document resides.
|`type`
|`string` - The type of the document.
|`id` |`id`
|`string` - The id of the document, when not specified a doc param should be supplied. |`string` - The id of the document, when not specified a doc param should be supplied.
@ -4062,6 +4083,9 @@ link:{ref}/docs-update-by-query.html[Reference]
|`index` |`index`
|`string, string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |`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` |`analyzer`
|`string` - The analyzer to use for the query string |`string` - The analyzer to use for the query string