Support for Elasticsearch 7.6 (#1075)

This commit is contained in:
Tomas Della Vedova
2020-02-12 11:17:56 +01:00
committed by GitHub
parent d19313a72c
commit 8bd5c4c4ce
25 changed files with 993 additions and 51 deletions

View File

@ -0,0 +1,76 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildGetScriptContext (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
/**
* Perform a get_script_context request
* Returns all script contexts.
*/
return function getScriptContext (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if (method == null) method = 'GET'
path = '/' + '_script_context'
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildGetScriptContext

View File

@ -0,0 +1,76 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildGetScriptLanguages (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
/**
* Perform a get_script_languages request
* Returns available script types, languages and contexts
*/
return function getScriptLanguages (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if (method == null) method = 'GET'
path = '/' + '_script_language'
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildGetScriptLanguages

View File

@ -32,7 +32,7 @@ function buildIndicesFlushSynced (opts) {
/**
* Perform a indices.flush_synced request
* Performs a synced flush operation on one or more indices.
* Performs a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush-api.html
*/
return function indicesFlushSynced (params, options, callback) {

View File

@ -12,11 +12,12 @@ function buildLicenseGet (opts) {
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'local'
'local',
'accept_enterprise'
]
const snakeCase = {
acceptEnterprise: 'accept_enterprise'
}
/**

View File

@ -12,7 +12,7 @@ function buildMlDeleteDataFrameAnalytics (opts) {
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'force'
]
const snakeCase = {

View File

@ -0,0 +1,77 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildMlDeleteTrainedModel (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
]
const snakeCase = {
}
/**
* Perform a ml.delete_trained_model request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference.html
*/
return function mlDeleteTrainedModel (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['model_id'] == null && params['modelId'] == null) {
const err = new ConfigurationError('Missing required parameter: model_id or modelId')
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, modelId, model_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if (method == null) method = 'DELETE'
path = '/' + '_ml' + '/' + 'inference' + '/' + encodeURIComponent(model_id || modelId)
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildMlDeleteTrainedModel

View File

@ -0,0 +1,76 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildMlExplainDataFrameAnalytics (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
]
const snakeCase = {
}
/**
* Perform a ml.explain_data_frame_analytics request
* http://www.elastic.co/guide/en/elasticsearch/reference/current/explain-dfanalytics.html
*/
return function mlExplainDataFrameAnalytics (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((id) != null) {
if (method == null) method = body == null ? 'GET' : 'POST'
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_explain'
} else {
if (method == null) method = body == null ? 'GET' : 'POST'
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + '_explain'
}
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildMlExplainDataFrameAnalytics

View File

@ -0,0 +1,83 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildMlGetTrainedModels (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'allow_no_match',
'include_model_definition',
'decompress_definition',
'from',
'size'
]
const snakeCase = {
allowNoMatch: 'allow_no_match',
includeModelDefinition: 'include_model_definition',
decompressDefinition: 'decompress_definition'
}
/**
* Perform a ml.get_trained_models request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/get-inference.html
*/
return function mlGetTrainedModels (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, modelId, model_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((model_id || modelId) != null) {
if (method == null) method = 'GET'
path = '/' + '_ml' + '/' + 'inference' + '/' + encodeURIComponent(model_id || modelId)
} else {
if (method == null) method = 'GET'
path = '/' + '_ml' + '/' + 'inference'
}
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildMlGetTrainedModels

View File

@ -0,0 +1,79 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildMlGetTrainedModelsStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'allow_no_match',
'from',
'size'
]
const snakeCase = {
allowNoMatch: 'allow_no_match'
}
/**
* Perform a ml.get_trained_models_stats request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/get-inference-stats.html
*/
return function mlGetTrainedModelsStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, modelId, model_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((model_id || modelId) != null) {
if (method == null) method = 'GET'
path = '/' + '_ml' + '/' + 'inference' + '/' + encodeURIComponent(model_id || modelId) + '/' + '_stats'
} else {
if (method == null) method = 'GET'
path = '/' + '_ml' + '/' + 'inference' + '/' + '_stats'
}
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildMlGetTrainedModelsStats

View File

@ -7,7 +7,7 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildMlEstimateMemoryUsage (opts) {
function buildMlPutTrainedModel (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
@ -20,10 +20,10 @@ function buildMlEstimateMemoryUsage (opts) {
}
/**
* Perform a ml.estimate_memory_usage request
* http://www.elastic.co/guide/en/elasticsearch/reference/current/estimate-memory-usage-dfanalytics.html
* Perform a ml.put_trained_model request
* TODO
*/
return function mlEstimateMemoryUsage (params, options, callback) {
return function mlPutTrainedModel (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -36,6 +36,10 @@ function buildMlEstimateMemoryUsage (opts) {
}
// check required parameters
if (params['model_id'] == null && params['modelId'] == null) {
const err = new ConfigurationError('Missing required parameter: model_id or modelId')
return handleError(err, callback)
}
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
return handleError(err, callback)
@ -48,7 +52,7 @@ function buildMlEstimateMemoryUsage (opts) {
}
var warnings = []
var { method, body, ...querystring } = params
var { method, body, modelId, model_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
@ -58,8 +62,8 @@ function buildMlEstimateMemoryUsage (opts) {
var path = ''
if (method == null) method = 'POST'
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + '_estimate_memory_usage'
if (method == null) method = 'PUT'
path = '/' + '_ml' + '/' + 'inference' + '/' + encodeURIComponent(model_id || modelId)
// build request object
const request = {
@ -74,4 +78,4 @@ function buildMlEstimateMemoryUsage (opts) {
}
}
module.exports = buildMlEstimateMemoryUsage
module.exports = buildMlPutTrainedModel

View File

@ -15,6 +15,7 @@ function buildRankEval (opts) {
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'search_type',
'pretty',
'human',
'error_trace',
@ -26,6 +27,7 @@ function buildRankEval (opts) {
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
searchType: 'search_type',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -21,7 +21,7 @@ function buildSlmDeleteLifecycle (opts) {
/**
* Perform a slm.delete_lifecycle request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete.html
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete-policy.html
*/
return function slmDeleteLifecycle (params, options, callback) {
options = options || {}

View File

@ -21,7 +21,7 @@ function buildSlmExecuteLifecycle (opts) {
/**
* Perform a slm.execute_lifecycle request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute.html
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute-policy.html
*/
return function slmExecuteLifecycle (params, options, callback) {
options = options || {}

View File

@ -21,7 +21,7 @@ function buildSlmGetLifecycle (opts) {
/**
* Perform a slm.get_lifecycle request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get.html
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get-policy.html
*/
return function slmGetLifecycle (params, options, callback) {
options = options || {}

View File

@ -21,7 +21,7 @@ function buildSlmGetStats (opts) {
/**
* Perform a slm.get_stats request
* https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-get-stats.html
* https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-get-stats.html
*/
return function slmGetStats (params, options, callback) {
options = options || {}

71
api/api/slm.get_status.js Normal file
View File

@ -0,0 +1,71 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildSlmGetStatus (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
]
const snakeCase = {
}
/**
* Perform a slm.get_status request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-get-status.html
*/
return function slmGetStatus (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if (method == null) method = 'GET'
path = '/' + '_slm' + '/' + 'status'
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildSlmGetStatus

View File

@ -21,7 +21,7 @@ function buildSlmPutLifecycle (opts) {
/**
* Perform a slm.put_lifecycle request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put.html
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put-policy.html
*/
return function slmPutLifecycle (params, options, callback) {
options = options || {}

71
api/api/slm.start.js Normal file
View File

@ -0,0 +1,71 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildSlmStart (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
]
const snakeCase = {
}
/**
* Perform a slm.start request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-start.html
*/
return function slmStart (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if (method == null) method = 'POST'
path = '/' + '_slm' + '/' + 'start'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildSlmStart

71
api/api/slm.stop.js Normal file
View File

@ -0,0 +1,71 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildSlmStop (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
]
const snakeCase = {
}
/**
* Perform a slm.stop request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-stop.html
*/
return function slmStop (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if (method == null) method = 'POST'
path = '/' + '_slm' + '/' + 'stop'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildSlmStop

View File

@ -12,14 +12,17 @@ function buildTransformStopTransform (opts) {
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'force',
'wait_for_completion',
'timeout',
'allow_no_match'
'allow_no_match',
'wait_for_checkpoint'
]
const snakeCase = {
waitForCompletion: 'wait_for_completion',
allowNoMatch: 'allow_no_match'
allowNoMatch: 'allow_no_match',
waitForCheckpoint: 'wait_for_checkpoint'
}
/**