Compare commits

..

5 Commits

Author SHA1 Message Date
53e29db80e Bumped v7.6.0 2020-02-12 14:01:09 +01:00
8bd5c4c4ce Support for Elasticsearch 7.6 (#1075) 2020-02-12 11:17:56 +01:00
d19313a72c Update integration test runner (#1085)
* Improved user and roles handling

* Avoid deleting internal indices

* Updated skip version handling

* Fix leftover

* Improved indices and aliases cleanup

* Clean also internal indices

* Restore previous index/alias cleanup

* Ignore 404
2020-02-11 10:51:08 +01:00
874b04f819 Added integration test stats (#1083) 2020-02-06 12:11:14 +01:00
a91e5375ac Fix link 2020-02-04 12:10:02 +01:00
29 changed files with 1063 additions and 129 deletions

View File

@ -1,6 +1,6 @@
---
ELASTICSEARCH_VERSION:
- 7.5.0
- 7.6-SNAPSHOT
NODE_JS_VERSION:
- 12

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'
}
/**

View File

@ -113,6 +113,10 @@ function ESAPI (opts) {
get: lazyLoad('get', opts),
get_script: lazyLoad('get_script', opts),
getScript: lazyLoad('get_script', opts),
get_script_context: lazyLoad('get_script_context', opts),
getScriptContext: lazyLoad('get_script_context', opts),
get_script_languages: lazyLoad('get_script_languages', opts),
getScriptLanguages: lazyLoad('get_script_languages', opts),
get_source: lazyLoad('get_source', opts),
getSource: lazyLoad('get_source', opts),
graph: {
@ -254,10 +258,12 @@ function ESAPI (opts) {
deleteJob: lazyLoad('ml.delete_job', opts),
delete_model_snapshot: lazyLoad('ml.delete_model_snapshot', opts),
deleteModelSnapshot: lazyLoad('ml.delete_model_snapshot', opts),
estimate_memory_usage: lazyLoad('ml.estimate_memory_usage', opts),
estimateMemoryUsage: lazyLoad('ml.estimate_memory_usage', opts),
delete_trained_model: lazyLoad('ml.delete_trained_model', opts),
deleteTrainedModel: lazyLoad('ml.delete_trained_model', opts),
evaluate_data_frame: lazyLoad('ml.evaluate_data_frame', opts),
evaluateDataFrame: lazyLoad('ml.evaluate_data_frame', opts),
explain_data_frame_analytics: lazyLoad('ml.explain_data_frame_analytics', opts),
explainDataFrameAnalytics: lazyLoad('ml.explain_data_frame_analytics', opts),
find_file_structure: lazyLoad('ml.find_file_structure', opts),
findFileStructure: lazyLoad('ml.find_file_structure', opts),
flush_job: lazyLoad('ml.flush_job', opts),
@ -293,6 +299,10 @@ function ESAPI (opts) {
getOverallBuckets: lazyLoad('ml.get_overall_buckets', opts),
get_records: lazyLoad('ml.get_records', opts),
getRecords: lazyLoad('ml.get_records', opts),
get_trained_models: lazyLoad('ml.get_trained_models', opts),
getTrainedModels: lazyLoad('ml.get_trained_models', opts),
get_trained_models_stats: lazyLoad('ml.get_trained_models_stats', opts),
getTrainedModelsStats: lazyLoad('ml.get_trained_models_stats', opts),
info: lazyLoad('ml.info', opts),
open_job: lazyLoad('ml.open_job', opts),
openJob: lazyLoad('ml.open_job', opts),
@ -314,6 +324,8 @@ function ESAPI (opts) {
putFilter: lazyLoad('ml.put_filter', opts),
put_job: lazyLoad('ml.put_job', opts),
putJob: lazyLoad('ml.put_job', opts),
put_trained_model: lazyLoad('ml.put_trained_model', opts),
putTrainedModel: lazyLoad('ml.put_trained_model', opts),
revert_model_snapshot: lazyLoad('ml.revert_model_snapshot', opts),
revertModelSnapshot: lazyLoad('ml.revert_model_snapshot', opts),
set_upgrade_mode: lazyLoad('ml.set_upgrade_mode', opts),
@ -454,8 +466,12 @@ function ESAPI (opts) {
getLifecycle: lazyLoad('slm.get_lifecycle', opts),
get_stats: lazyLoad('slm.get_stats', opts),
getStats: lazyLoad('slm.get_stats', opts),
get_status: lazyLoad('slm.get_status', opts),
getStatus: lazyLoad('slm.get_status', opts),
put_lifecycle: lazyLoad('slm.put_lifecycle', opts),
putLifecycle: lazyLoad('slm.put_lifecycle', opts)
putLifecycle: lazyLoad('slm.put_lifecycle', opts),
start: lazyLoad('slm.start', opts),
stop: lazyLoad('slm.stop', opts)
},
snapshot: {
cleanup_repository: lazyLoad('snapshot.cleanup_repository', opts),

View File

@ -87,7 +87,7 @@ export interface CatHelp extends Generic {
export interface CatIndices extends Generic {
index?: string | string[];
format?: string;
bytes?: 'b' | 'k' | 'm' | 'g';
bytes?: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb';
local?: boolean;
master_timeout?: string;
h?: string | string[];
@ -512,6 +512,12 @@ export interface GetScript extends Generic {
master_timeout?: string;
}
export interface GetScriptContext extends Generic {
}
export interface GetScriptLanguages extends Generic {
}
export interface GetSource extends Generic {
id: string;
index: string;
@ -1050,6 +1056,7 @@ export interface RankEval<T = any> extends Generic {
ignore_unavailable?: boolean;
allow_no_indices?: boolean;
expand_wildcards?: 'open' | 'closed' | 'none' | 'all';
search_type?: 'query_then_fetch' | 'dfs_query_then_fetch';
body: T;
}
@ -1501,6 +1508,7 @@ export interface LicenseDelete extends Generic {
export interface LicenseGet extends Generic {
local?: boolean;
accept_enterprise?: boolean;
}
export interface LicenseGetBasicStatus extends Generic {
@ -1551,6 +1559,7 @@ export interface MlDeleteCalendarJob extends Generic {
export interface MlDeleteDataFrameAnalytics extends Generic {
id: string;
force?: boolean;
}
export interface MlDeleteDatafeed extends Generic {
@ -1583,14 +1592,19 @@ export interface MlDeleteModelSnapshot extends Generic {
snapshot_id: string;
}
export interface MlEstimateMemoryUsage<T = any> extends Generic {
body: T;
export interface MlDeleteTrainedModel extends Generic {
model_id: string;
}
export interface MlEvaluateDataFrame<T = any> extends Generic {
body: T;
}
export interface MlExplainDataFrameAnalytics<T = any> extends Generic {
id?: string;
body?: T;
}
export interface MlFindFileStructure<T = any> extends Generic {
lines_to_sample?: number;
line_merge_size_limit?: number;
@ -1754,6 +1768,22 @@ export interface MlGetRecords<T = any> extends Generic {
body?: T;
}
export interface MlGetTrainedModels extends Generic {
model_id?: string;
allow_no_match?: boolean;
include_model_definition?: boolean;
decompress_definition?: boolean;
from?: number;
size?: number;
}
export interface MlGetTrainedModelsStats extends Generic {
model_id?: string;
allow_no_match?: boolean;
from?: number;
size?: number;
}
export interface MlInfo extends Generic {
}
@ -1807,6 +1837,11 @@ export interface MlPutJob<T = any> extends Generic {
body: T;
}
export interface MlPutTrainedModel<T = any> extends Generic {
model_id: string;
body: T;
}
export interface MlRevertModelSnapshot<T = any> extends Generic {
job_id: string;
snapshot_id: string;
@ -2067,11 +2102,20 @@ export interface SlmGetLifecycle extends Generic {
export interface SlmGetStats extends Generic {
}
export interface SlmGetStatus extends Generic {
}
export interface SlmPutLifecycle<T = any> extends Generic {
policy_id: string;
body?: T;
}
export interface SlmStart extends Generic {
}
export interface SlmStop extends Generic {
}
export interface SqlClearCursor<T = any> extends Generic {
body: T;
}
@ -2124,9 +2168,11 @@ export interface TransformStartTransform extends Generic {
export interface TransformStopTransform extends Generic {
transform_id: string;
force?: boolean;
wait_for_completion?: boolean;
timeout?: string;
allow_no_match?: boolean;
wait_for_checkpoint?: boolean;
}
export interface TransformUpdateTransform<T = any> extends Generic {

View File

@ -101,7 +101,7 @@ link:{ref}/docs-bulk.html[Documentation] +
|`string` - Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
|`refresh`
|`'true' \| 'false' \| 'wait_for'` - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
|`'true' \| 'false' \| 'wait_for'` - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
|`routing`
|`string` - Specific routing value
@ -358,7 +358,7 @@ link:{ref}/cat.html[Documentation] +
client.cat.indices({
index: string | string[],
format: string,
bytes: 'b' | 'k' | 'm' | 'g',
bytes: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb',
local: boolean,
master_timeout: string,
h: string | string[],
@ -381,7 +381,7 @@ link:{ref}/cat-indices.html[Documentation] +
|`string` - a short version of the Accept header, e.g. json, yaml
|`bytes`
|`'b' \| 'k' \| 'm' \| 'g'` - The unit in which to display byte values
|`'b' \| 'k' \| 'kb' \| 'm' \| 'mb' \| 'g' \| 'gb' \| 't' \| 'tb' \| 'p' \| 'pb'` - The unit in which to display byte values
|`local`
|`boolean` - Return local information, do not retrieve the state from master node (default: false)
@ -525,7 +525,9 @@ link:{ref}/cat-nodes.html[Documentation] +
|`boolean` - Return the full node ID instead of the shortened version (default: false)
|`local`
|`boolean` - Return local information, do not retrieve the state from master node (default: false)
|`boolean` - Calculate the selected nodes using the local cluster state rather than the state from master node (default: false) +
WARNING: This parameter has been deprecated.
|`master_timeout` or `masterTimeout`
|`string` - Explicit operation timeout for connection to master node
@ -1493,7 +1495,7 @@ WARNING: This parameter has been deprecated.
|`string` - Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
|`refresh`
|`'true' \| 'false' \| 'wait_for'` - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
|`'true' \| 'false' \| 'wait_for'` - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
|`routing`
|`string` - Specific routing value
@ -2049,6 +2051,22 @@ link:{ref}/modules-scripting.html[Documentation] +
|===
=== getScriptContext
*Stability:* experimental
[source,ts]
----
client.getScriptContext()
----
=== getScriptLanguages
*Stability:* experimental
[source,ts]
----
client.getScriptLanguages()
----
=== getSource
[source,ts]
@ -4215,6 +4233,7 @@ client.rankEval({
ignore_unavailable: boolean,
allow_no_indices: boolean,
expand_wildcards: 'open' | 'closed' | 'none' | 'all',
search_type: 'query_then_fetch' | 'dfs_query_then_fetch',
body: object
})
----
@ -4234,6 +4253,9 @@ link:{ref}/search-rank-eval.html[Documentation] +
|`'open' \| 'closed' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. +
_Default:_ `open`
|`search_type` or `searchType`
|`'query_then_fetch' \| 'dfs_query_then_fetch'` - Search operation type
|`body`
|`object` - The ranking evaluation search definition, including search requests, document ratings and ranking metric definition.
@ -4260,7 +4282,7 @@ link:{ref}/docs-reindex.html[Documentation] +
[cols=2*]
|===
|`refresh`
|`boolean` - Should the effected indexes be refreshed?
|`boolean` - Should the affected indexes be refreshed?
|`timeout`
|`string` - Time each individual bulk request should wait for shards that are unavailable. +
@ -5196,7 +5218,7 @@ WARNING: This parameter has been deprecated.
|`string` - The script language (default: painless)
|`refresh`
|`'true' \| 'false' \| 'wait_for'` - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
|`'true' \| 'false' \| 'wait_for'` - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
|`retry_on_conflict` or `retryOnConflict`
|`number` - Specify how many times should the operation be retried when a conflict occurs (default: 0)
@ -5361,7 +5383,7 @@ _Default:_ `open`
|`boolean` - Specify if request cache should be used for this request or not, defaults to index level setting
|`refresh`
|`boolean` - Should the effected indexes be refreshed?
|`boolean` - Should the affected indexes be refreshed?
|`timeout`
|`string` - Time each individual bulk request should wait for shards that are unavailable. +
@ -5939,7 +5961,7 @@ _Default:_ `closed`
|===
=== indices.reloadSearchAnalyzers
*Stability:* experimental
[source,ts]
----
client.indices.reloadSearchAnalyzers({
@ -6022,7 +6044,8 @@ link:{ref}/delete-license.html[Documentation] +
[source,ts]
----
client.license.get({
local: boolean
local: boolean,
accept_enterprise: boolean
})
----
link:{ref}/get-license.html[Documentation] +
@ -6031,6 +6054,9 @@ link:{ref}/get-license.html[Documentation] +
|`local`
|`boolean` - Return local information, do not retrieve the state from master node (default: false)
|`accept_enterprise` or `acceptEnterprise`
|`boolean` - If the active license is an enterprise license, return type as 'enterprise' (default: false)
|===
=== license.getBasicStatus
@ -6213,7 +6239,8 @@ client.ml.deleteCalendarJob({
[source,ts]
----
client.ml.deleteDataFrameAnalytics({
id: string
id: string,
force: boolean
})
----
link:{ref}/delete-dfanalytics.html[Documentation] +
@ -6222,6 +6249,9 @@ link:{ref}/delete-dfanalytics.html[Documentation] +
|`id`
|`string` - The ID of the data frame analytics to delete
|`force`
|`boolean` - True if the job should be forcefully deleted
|===
=== ml.deleteDatafeed
@ -6340,19 +6370,19 @@ link:{ref}/ml-delete-snapshot.html[Documentation] +
|===
=== ml.estimateMemoryUsage
=== ml.deleteTrainedModel
*Stability:* experimental
[source,ts]
----
client.ml.estimateMemoryUsage({
body: object
client.ml.deleteTrainedModel({
model_id: string
})
----
link:{ref}/estimate-memory-usage-dfanalytics.html[Documentation] +
link:{ref}/delete-inference.html[Documentation] +
[cols=2*]
|===
|`body`
|`object` - Memory usage estimation definition
|`model_id` or `modelId`
|`string` - The ID of the trained model to delete
|===
@ -6372,6 +6402,26 @@ link:{ref}/evaluate-dfanalytics.html[Documentation] +
|===
=== ml.explainDataFrameAnalytics
*Stability:* experimental
[source,ts]
----
client.ml.explainDataFrameAnalytics({
id: string,
body: object
})
----
link:{ref}/explain-dfanalytics.html[Documentation] +
[cols=2*]
|===
|`id`
|`string` - The ID of the data frame analytics to explain
|`body`
|`object` - The data frame analytics config to explain
|===
=== ml.findFileStructure
*Stability:* experimental
[source,ts]
@ -7027,6 +7077,75 @@ link:{ref}/ml-get-record.html[Documentation] +
|===
=== ml.getTrainedModels
*Stability:* experimental
[source,ts]
----
client.ml.getTrainedModels({
model_id: string,
allow_no_match: boolean,
include_model_definition: boolean,
decompress_definition: boolean,
from: number,
size: number
})
----
link:{ref}/get-inference.html[Documentation] +
[cols=2*]
|===
|`model_id` or `modelId`
|`string` - The ID of the trained models to fetch
|`allow_no_match` or `allowNoMatch`
|`boolean` - Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified) +
_Default:_ `true`
|`include_model_definition` or `includeModelDefinition`
|`boolean` - Should the full model definition be included in the results. These definitions can be large. So be cautious when including them. Defaults to false.
|`decompress_definition` or `decompressDefinition`
|`boolean` - Should the model definition be decompressed into valid JSON or returned in a custom compressed format. Defaults to true. +
_Default:_ `true`
|`from`
|`number` - skips a number of trained models
|`size`
|`number` - specifies a max number of trained models to get +
_Default:_ `100`
|===
=== ml.getTrainedModelsStats
*Stability:* experimental
[source,ts]
----
client.ml.getTrainedModelsStats({
model_id: string,
allow_no_match: boolean,
from: number,
size: number
})
----
link:{ref}/get-inference-stats.html[Documentation] +
[cols=2*]
|===
|`model_id` or `modelId`
|`string` - The ID of the trained models stats to fetch
|`allow_no_match` or `allowNoMatch`
|`boolean` - Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified) +
_Default:_ `true`
|`from`
|`number` - skips a number of trained models
|`size`
|`number` - specifies a max number of trained models to get +
_Default:_ `100`
|===
=== ml.info
[source,ts]
@ -7231,6 +7350,26 @@ link:{ref}/ml-put-job.html[Documentation] +
|===
=== ml.putTrainedModel
*Stability:* experimental
[source,ts]
----
client.ml.putTrainedModel({
model_id: string,
body: object
})
----
link:TODO[Documentation] +
[cols=2*]
|===
|`model_id` or `modelId`
|`string` - The ID of the trained models to store
|`body`
|`object` - The trained model configuration
|===
=== ml.revertModelSnapshot
[source,ts]
@ -8191,7 +8330,7 @@ client.slm.deleteLifecycle({
policy_id: string
})
----
link:{ref}/slm-api-delete.html[Documentation] +
link:{ref}/slm-api-delete-policy.html[Documentation] +
[cols=2*]
|===
|`policy_id` or `policyId`
@ -8207,7 +8346,7 @@ client.slm.executeLifecycle({
policy_id: string
})
----
link:{ref}/slm-api-execute.html[Documentation] +
link:{ref}/slm-api-execute-lifecycle.html[Documentation] +
[cols=2*]
|===
|`policy_id` or `policyId`
@ -8232,7 +8371,7 @@ client.slm.getLifecycle({
policy_id: string | string[]
})
----
link:{ref}/slm-api-get.html[Documentation] +
link:{ref}/slm-api-get-policy.html[Documentation] +
[cols=2*]
|===
|`policy_id` or `policyId`
@ -8246,7 +8385,16 @@ link:{ref}/slm-api-get.html[Documentation] +
----
client.slm.getStats()
----
link:{ref}/slm-get-stats.html[Documentation] +
link:{ref}/slm-api-get-stats.html[Documentation] +
=== slm.getStatus
[source,ts]
----
client.slm.getStatus()
----
link:{ref}/slm-api-get-status.html[Documentation] +
=== slm.putLifecycle
@ -8258,7 +8406,7 @@ client.slm.putLifecycle({
body: object
})
----
link:{ref}/slm-api-put.html[Documentation] +
link:{ref}/slm-api-put-policy.html[Documentation] +
[cols=2*]
|===
|`policy_id` or `policyId`
@ -8269,6 +8417,24 @@ link:{ref}/slm-api-put.html[Documentation] +
|===
=== slm.start
[source,ts]
----
client.slm.start()
----
link:{ref}/slm-api-start.html[Documentation] +
=== slm.stop
[source,ts]
----
client.slm.stop()
----
link:{ref}/slm-api-stop.html[Documentation] +
=== sql.clearCursor
[source,ts]
@ -8473,9 +8639,11 @@ link:{ref}/start-transform.html[Documentation] +
----
client.transform.stopTransform({
transform_id: string,
force: boolean,
wait_for_completion: boolean,
timeout: string,
allow_no_match: boolean
allow_no_match: boolean,
wait_for_checkpoint: boolean
})
----
link:{ref}/stop-transform.html[Documentation] +
@ -8484,6 +8652,9 @@ link:{ref}/stop-transform.html[Documentation] +
|`transform_id` or `transformId`
|`string` - The id of the transform to stop
|`force`
|`boolean` - Whether to force stop a failed transform or not. Default to false
|`wait_for_completion` or `waitForCompletion`
|`boolean` - Whether to wait for the transform to fully stop before returning or not. Default to false
@ -8493,6 +8664,9 @@ link:{ref}/stop-transform.html[Documentation] +
|`allow_no_match` or `allowNoMatch`
|`boolean` - Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)
|`wait_for_checkpoint` or `waitForCheckpoint`
|`boolean` - Whether to wait for the transform to reach a checkpoint before stopping. Default to false
|===
=== transform.updateTransform

20
index.d.ts vendored
View File

@ -212,6 +212,10 @@ declare class Client extends EventEmitter {
get: ApiMethod<RequestParams.Get>
get_script: ApiMethod<RequestParams.GetScript>
getScript: ApiMethod<RequestParams.GetScript>
get_script_context: ApiMethod<RequestParams.GetScriptContext>
getScriptContext: ApiMethod<RequestParams.GetScriptContext>
get_script_languages: ApiMethod<RequestParams.GetScriptLanguages>
getScriptLanguages: ApiMethod<RequestParams.GetScriptLanguages>
get_source: ApiMethod<RequestParams.GetSource>
getSource: ApiMethod<RequestParams.GetSource>
graph: {
@ -353,10 +357,12 @@ declare class Client extends EventEmitter {
deleteJob: ApiMethod<RequestParams.MlDeleteJob>
delete_model_snapshot: ApiMethod<RequestParams.MlDeleteModelSnapshot>
deleteModelSnapshot: ApiMethod<RequestParams.MlDeleteModelSnapshot>
estimate_memory_usage: ApiMethod<RequestParams.MlEstimateMemoryUsage>
estimateMemoryUsage: ApiMethod<RequestParams.MlEstimateMemoryUsage>
delete_trained_model: ApiMethod<RequestParams.MlDeleteTrainedModel>
deleteTrainedModel: ApiMethod<RequestParams.MlDeleteTrainedModel>
evaluate_data_frame: ApiMethod<RequestParams.MlEvaluateDataFrame>
evaluateDataFrame: ApiMethod<RequestParams.MlEvaluateDataFrame>
explain_data_frame_analytics: ApiMethod<RequestParams.MlExplainDataFrameAnalytics>
explainDataFrameAnalytics: ApiMethod<RequestParams.MlExplainDataFrameAnalytics>
find_file_structure: ApiMethod<RequestParams.MlFindFileStructure>
findFileStructure: ApiMethod<RequestParams.MlFindFileStructure>
flush_job: ApiMethod<RequestParams.MlFlushJob>
@ -392,6 +398,10 @@ declare class Client extends EventEmitter {
getOverallBuckets: ApiMethod<RequestParams.MlGetOverallBuckets>
get_records: ApiMethod<RequestParams.MlGetRecords>
getRecords: ApiMethod<RequestParams.MlGetRecords>
get_trained_models: ApiMethod<RequestParams.MlGetTrainedModels>
getTrainedModels: ApiMethod<RequestParams.MlGetTrainedModels>
get_trained_models_stats: ApiMethod<RequestParams.MlGetTrainedModelsStats>
getTrainedModelsStats: ApiMethod<RequestParams.MlGetTrainedModelsStats>
info: ApiMethod<RequestParams.MlInfo>
open_job: ApiMethod<RequestParams.MlOpenJob>
openJob: ApiMethod<RequestParams.MlOpenJob>
@ -413,6 +423,8 @@ declare class Client extends EventEmitter {
putFilter: ApiMethod<RequestParams.MlPutFilter>
put_job: ApiMethod<RequestParams.MlPutJob>
putJob: ApiMethod<RequestParams.MlPutJob>
put_trained_model: ApiMethod<RequestParams.MlPutTrainedModel>
putTrainedModel: ApiMethod<RequestParams.MlPutTrainedModel>
revert_model_snapshot: ApiMethod<RequestParams.MlRevertModelSnapshot>
revertModelSnapshot: ApiMethod<RequestParams.MlRevertModelSnapshot>
set_upgrade_mode: ApiMethod<RequestParams.MlSetUpgradeMode>
@ -553,8 +565,12 @@ declare class Client extends EventEmitter {
getLifecycle: ApiMethod<RequestParams.SlmGetLifecycle>
get_stats: ApiMethod<RequestParams.SlmGetStats>
getStats: ApiMethod<RequestParams.SlmGetStats>
get_status: ApiMethod<RequestParams.SlmGetStatus>
getStatus: ApiMethod<RequestParams.SlmGetStatus>
put_lifecycle: ApiMethod<RequestParams.SlmPutLifecycle>
putLifecycle: ApiMethod<RequestParams.SlmPutLifecycle>
start: ApiMethod<RequestParams.SlmStart>
stop: ApiMethod<RequestParams.SlmStop>
}
snapshot: {
cleanup_repository: ApiMethod<RequestParams.SnapshotCleanupRepository>

View File

@ -4,7 +4,7 @@
"main": "index.js",
"types": "index.d.ts",
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
"version": "7.5.1",
"version": "7.6.0",
"keywords": [
"elasticsearch",
"elastic",

View File

@ -4,48 +4,6 @@
'use strict'
const esDefaultRoles = [
'apm_system',
'apm_user',
'beats_admin',
'beats_system',
'code_admin',
'code_user',
'data_frame_transforms_admin',
'data_frame_transforms_user',
'enrich_user',
'ingest_admin',
'kibana_dashboard_only_user',
'kibana_system',
'kibana_user',
'logstash_admin',
'logstash_system',
'machine_learning_admin',
'machine_learning_user',
'monitoring_user',
'remote_monitoring_agent',
'remote_monitoring_collector',
'reporting_user',
'rollup_admin',
'rollup_user',
'snapshot_user',
'superuser',
'transform_admin',
'transform_user',
'transport_client',
'watcher_admin',
'watcher_user'
]
const esDefaultUsers = [
'apm_system',
'beats_system',
'elastic',
'logstash_system',
'kibana',
'remote_monitoring_user'
]
function runInParallel (client, operation, options, clientOptions) {
if (options.length === 0) return Promise.resolve()
const operations = options.map(opts => {
@ -76,4 +34,4 @@ function to (promise) {
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
module.exports = { runInParallel, esDefaultRoles, esDefaultUsers, delve, to, sleep }
module.exports = { runInParallel, delve, to, sleep }

View File

@ -20,7 +20,7 @@ const xPackYamlFolder = join(esFolder, 'x-pack', 'plugin', 'src', 'test', 'resou
const MAX_API_TIME = 1000 * 90
const MAX_FILE_TIME = 1000 * 30
const MAX_TEST_TIME = 1000 * 2
const MAX_TEST_TIME = 1000 * 3
const ossSkips = {
'cat.indices/10_basic.yml': ['Test cat indices output for closed index (pre 7.2.0)'],
@ -111,6 +111,12 @@ async function start ({ client, isXPack }) {
log(`Testing ${isXPack ? 'XPack' : 'oss'} api...`)
const stats = {
total: 0,
skip: 0,
pass: 0,
assertions: 0
}
const folders = getAllFiles(isXPack ? xPackYamlFolder : yamlFolder)
.filter(t => !/(README|TODO)/g.test(t))
// we cluster the array based on the folder names,
@ -172,10 +178,15 @@ async function start ({ client, isXPack }) {
const testTime = now()
const name = Object.keys(test)[0]
if (name === 'setup' || name === 'teardown') continue
if (shouldSkip(isXPack, file, name)) continue
stats.total += 1
if (shouldSkip(isXPack, file, name)) {
stats.skip += 1
continue
}
log(' - ' + name)
try {
await testRunner.run(setupTest, test[name], teardownTest)
await testRunner.run(setupTest, test[name], teardownTest, stats)
stats.pass += 1
} catch (err) {
console.error(err)
process.exit(1)
@ -202,6 +213,12 @@ async function start ({ client, isXPack }) {
}
}
log(`Total testing time: ${ms(now() - totalTime)}`)
log(`Test stats:
- Total: ${stats.total}
- Skip: ${stats.skip}
- Pass: ${stats.pass}
- Assertions: ${stats.assertions}
`)
}
function log (text) {

View File

@ -38,23 +38,21 @@ function build (opts = {}) {
* @returns {Promise}
*/
async function cleanup () {
// // tap.comment('Cleanup')
response = null
stash.clear()
try {
await client.indices.delete({ index: '_all' }, { ignore: 404 })
} catch (err) {
assert.ifError(err, 'should not error: indices.delete')
}
try {
await client.indices.deleteAlias({ index: '_all', name: '_all' }, { ignore: 404 })
} catch (err) {
assert.ifError(err, 'should not error: indices.deleteAlias')
}
try {
await client.indices.delete({ index: '_all' }, { ignore: 404 })
} catch (err) {
assert.ifError(err, 'should not error: indices.delete')
}
try {
const { body: templates } = await client.indices.getTemplate()
await helper.runInParallel(
@ -91,7 +89,7 @@ function build (opts = {}) {
try {
const { body } = await client.security.getRole()
const roles = Object.keys(body).filter(n => helper.esDefaultRoles.indexOf(n) === -1)
const roles = Object.keys(body).filter(n => !body[n].metadata._reserved)
await helper.runInParallel(
client, 'security.deleteRole',
roles.map(r => ({ name: r }))
@ -102,7 +100,7 @@ function build (opts = {}) {
try {
const { body } = await client.security.getUser()
const users = Object.keys(body).filter(n => helper.esDefaultUsers.indexOf(n) === -1)
const users = Object.keys(body).filter(n => !body[n].metadata._reserved)
await helper.runInParallel(
client, 'security.deleteUser',
users.map(r => ({ username: r }))
@ -214,7 +212,7 @@ function build (opts = {}) {
* @oaram {object} teardown (null if not needed)
* @returns {Promise}
*/
async function run (setup, test, teardown) {
async function run (setup, test, teardown, stats) {
// if we should skip a feature in the setup/teardown section
// we should skip the entire test file
const skip = getSkip(setup) || getSkip(teardown)
@ -236,11 +234,11 @@ function build (opts = {}) {
}
}
if (setup) await exec('Setup', setup)
if (setup) await exec('Setup', setup, stats)
await exec('Test', test)
await exec('Test', test, stats)
if (teardown) await exec('Teardown', teardown)
if (teardown) await exec('Teardown', teardown, stats)
if (isXPack) await cleanupXPack()
@ -371,9 +369,14 @@ function build (opts = {}) {
* @param {object} the action to perform
* @returns {Promise}
*/
async function doAction (action) {
async function doAction (action, stats) {
const cmd = parseDo(action)
const api = delve(client, cmd.method).bind(client)
try {
var api = delve(client, cmd.method).bind(client)
} catch (err) {
console.error(`\nError: Cannot find the method '${cmd.method}' in the client.\n`)
process.exit(1)
}
const options = { ignore: cmd.params.ignore, headers: action.headers }
if (cmd.params.ignore) delete cmd.params.ignore
@ -414,10 +417,12 @@ function build (opts = {}) {
warnings = warnings.filter(h => !h.test(/default\snumber\sof\sshards/g))
}
stats.assertions += 1
assert.ok(deepEqual(warnings, action.warnings))
}
if (action.catch) {
stats.assertions += 1
assert.ok(
parseDoError(err, action.catch),
`the error should be: ${action.catch}`
@ -428,6 +433,7 @@ function build (opts = {}) {
response = err.body
}
} else {
stats.assertions += 1
assert.ifError(err, `should not error: ${cmd.method}`, action)
response = body
}
@ -439,7 +445,7 @@ function build (opts = {}) {
* @param {object} the actions to perform
* @returns {Promise}
*/
async function exec (name, actions) {
async function exec (name, actions, stats) {
// tap.comment(name)
for (const action of actions) {
if (action.skip) {
@ -450,7 +456,7 @@ function build (opts = {}) {
}
if (action.do) {
await doAction(fillStashedValues(action.do))
await doAction(fillStashedValues(action.do), stats)
}
if (action.set) {
@ -464,6 +470,7 @@ function build (opts = {}) {
}
if (action.match) {
stats.assertions += 1
const key = Object.keys(action.match)[0]
match(
// in some cases, the yaml refers to the body with an empty string
@ -478,6 +485,7 @@ function build (opts = {}) {
}
if (action.lt) {
stats.assertions += 1
const key = Object.keys(action.lt)[0]
lt(
delve(response, fillStashedValues(key)),
@ -486,6 +494,7 @@ function build (opts = {}) {
}
if (action.gt) {
stats.assertions += 1
const key = Object.keys(action.gt)[0]
gt(
delve(response, fillStashedValues(key)),
@ -494,6 +503,7 @@ function build (opts = {}) {
}
if (action.lte) {
stats.assertions += 1
const key = Object.keys(action.lte)[0]
lte(
delve(response, fillStashedValues(key)),
@ -502,6 +512,7 @@ function build (opts = {}) {
}
if (action.gte) {
stats.assertions += 1
const key = Object.keys(action.gte)[0]
gte(
delve(response, fillStashedValues(key)),
@ -510,6 +521,7 @@ function build (opts = {}) {
}
if (action.length) {
stats.assertions += 1
const key = Object.keys(action.length)[0]
length(
key === '$body' || key === ''
@ -522,6 +534,7 @@ function build (opts = {}) {
}
if (action.is_true) {
stats.assertions += 1
const isTrue = fillStashedValues(action.is_true)
is_true(
delve(response, isTrue),
@ -530,6 +543,7 @@ function build (opts = {}) {
}
if (action.is_false) {
stats.assertions += 1
const isFalse = fillStashedValues(action.is_false)
is_false(
delve(response, isFalse),
@ -820,19 +834,22 @@ function shouldSkip (esVersion, action) {
// skip based on the version
if (action.version) {
if (action.version.trim() === 'all') return true
const [min, max] = action.version.split('-').map(v => v.trim())
// if both `min` and `max` are specified
if (min && max) {
shouldSkip = semver.satisfies(esVersion, action.version)
// if only `min` is specified
} else if (min) {
shouldSkip = semver.gte(esVersion, min)
// if only `max` is specified
} else if (max) {
shouldSkip = semver.lte(esVersion, max)
// something went wrong!
} else {
throw new Error(`skip: Bad version range: ${action.version}`)
const versions = action.version.split(',').filter(Boolean)
for (const version of versions) {
const [min, max] = version.split('-').map(v => v.trim())
// if both `min` and `max` are specified
if (min && max) {
shouldSkip = semver.satisfies(esVersion, action.version)
// if only `min` is specified
} else if (min) {
shouldSkip = semver.gte(esVersion, min)
// if only `max` is specified
} else if (max) {
shouldSkip = semver.lte(esVersion, max)
// something went wrong!
} else {
throw new Error(`skip: Bad version range: ${action.version}`)
}
}
}