@elastic/elasticsearch 7.7.0-rc.2 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/api/api/async_search.submit.js +4 -0
- package/api/api/autoscaling.delete_autoscaling_policy.js +78 -0
- package/api/api/autoscaling.get_autoscaling_policy.js +78 -0
- package/api/api/autoscaling.put_autoscaling_policy.js +82 -0
- package/api/api/bulk.js +4 -0
- package/api/api/cluster.delete_component_template.js +1 -1
- package/api/api/cluster.delete_voting_config_exclusions.js +79 -0
- package/api/api/cluster.exists_component_template.js +86 -0
- package/api/api/cluster.get_component_template.js +1 -1
- package/api/api/cluster.post_voting_config_exclusions.js +82 -0
- package/api/api/cluster.put_component_template.js +1 -1
- package/api/api/delete_by_query.js +4 -0
- package/api/api/eql.search.js +1 -1
- package/api/api/exists.js +4 -0
- package/api/api/exists_source.js +4 -0
- package/api/api/explain.js +4 -0
- package/api/api/get.js +4 -0
- package/api/api/get_source.js +4 -0
- package/api/api/indices.delete_index_template.js +86 -0
- package/api/api/indices.exists_index_template.js +88 -0
- package/api/api/indices.get_index_template.js +87 -0
- package/api/api/indices.put_index_template.js +91 -0
- package/api/api/indices.simulate_index_template.js +87 -0
- package/api/api/mget.js +4 -0
- package/api/api/ml.delete_data_frame_analytics.js +2 -1
- package/api/api/ml.validate.js +1 -0
- package/api/api/ml.validate_detector.js +1 -0
- package/api/api/search.js +4 -0
- package/api/api/searchable_snapshots.clear_cache.js +83 -0
- package/api/api/searchable_snapshots.mount.js +94 -0
- package/api/api/searchable_snapshots.repository_stats.js +78 -0
- package/api/api/searchable_snapshots.stats.js +77 -0
- package/api/api/snapshot.cleanup_repository.js +1 -1
- package/api/api/tasks.cancel.js +2 -0
- package/api/api/update.js +4 -0
- package/api/api/update_by_query.js +4 -0
- package/api/index.js +39 -1
- package/api/requestParams.d.ts +119 -3
- package/index.d.ts +156 -16
- package/index.js +9 -2
- package/lib/Connection.js +8 -2
- package/lib/Helpers.d.ts +22 -5
- package/lib/Helpers.js +328 -32
- package/lib/Transport.js +30 -15
- package/lib/pool/BaseConnectionPool.js +2 -0
- package/lib/pool/CloudConnectionPool.js +1 -1
- package/lib/pool/ConnectionPool.js +12 -2
- package/package.json +21 -13
package/api/api/get.js
CHANGED
|
@@ -19,7 +19,9 @@ function buildGet (opts) {
|
|
|
19
19
|
'routing',
|
|
20
20
|
'_source',
|
|
21
21
|
'_source_excludes',
|
|
22
|
+
'_source_exclude',
|
|
22
23
|
'_source_includes',
|
|
24
|
+
'_source_include',
|
|
23
25
|
'version',
|
|
24
26
|
'version_type',
|
|
25
27
|
'pretty',
|
|
@@ -32,7 +34,9 @@ function buildGet (opts) {
|
|
|
32
34
|
const snakeCase = {
|
|
33
35
|
storedFields: 'stored_fields',
|
|
34
36
|
_sourceExcludes: '_source_excludes',
|
|
37
|
+
_sourceExclude: '_source_exclude',
|
|
35
38
|
_sourceIncludes: '_source_includes',
|
|
39
|
+
_sourceInclude: '_source_include',
|
|
36
40
|
versionType: 'version_type',
|
|
37
41
|
errorTrace: 'error_trace',
|
|
38
42
|
filterPath: 'filter_path'
|
package/api/api/get_source.js
CHANGED
|
@@ -18,7 +18,9 @@ function buildGetSource (opts) {
|
|
|
18
18
|
'routing',
|
|
19
19
|
'_source',
|
|
20
20
|
'_source_excludes',
|
|
21
|
+
'_source_exclude',
|
|
21
22
|
'_source_includes',
|
|
23
|
+
'_source_include',
|
|
22
24
|
'version',
|
|
23
25
|
'version_type',
|
|
24
26
|
'pretty',
|
|
@@ -30,7 +32,9 @@ function buildGetSource (opts) {
|
|
|
30
32
|
|
|
31
33
|
const snakeCase = {
|
|
32
34
|
_sourceExcludes: '_source_excludes',
|
|
35
|
+
_sourceExclude: '_source_exclude',
|
|
33
36
|
_sourceIncludes: '_source_includes',
|
|
37
|
+
_sourceInclude: '_source_include',
|
|
34
38
|
versionType: 'version_type',
|
|
35
39
|
errorTrace: 'error_trace',
|
|
36
40
|
filterPath: 'filter_path'
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Licensed to Elasticsearch B.V under one or more agreements.
|
|
2
|
+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
|
3
|
+
// See the LICENSE file in the project root for more information
|
|
4
|
+
|
|
5
|
+
'use strict'
|
|
6
|
+
|
|
7
|
+
/* eslint camelcase: 0 */
|
|
8
|
+
/* eslint no-unused-vars: 0 */
|
|
9
|
+
|
|
10
|
+
function buildIndicesDeleteIndexTemplate (opts) {
|
|
11
|
+
// eslint-disable-next-line no-unused-vars
|
|
12
|
+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
|
13
|
+
|
|
14
|
+
const acceptedQuerystring = [
|
|
15
|
+
'timeout',
|
|
16
|
+
'master_timeout',
|
|
17
|
+
'pretty',
|
|
18
|
+
'human',
|
|
19
|
+
'error_trace',
|
|
20
|
+
'source',
|
|
21
|
+
'filter_path'
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
const snakeCase = {
|
|
25
|
+
masterTimeout: 'master_timeout',
|
|
26
|
+
errorTrace: 'error_trace',
|
|
27
|
+
filterPath: 'filter_path'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Perform a indices.delete_index_template request
|
|
32
|
+
* Deletes an index template.
|
|
33
|
+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
|
|
34
|
+
*/
|
|
35
|
+
return function indicesDeleteIndexTemplate (params, options, callback) {
|
|
36
|
+
options = options || {}
|
|
37
|
+
if (typeof options === 'function') {
|
|
38
|
+
callback = options
|
|
39
|
+
options = {}
|
|
40
|
+
}
|
|
41
|
+
if (typeof params === 'function' || params == null) {
|
|
42
|
+
callback = params
|
|
43
|
+
params = {}
|
|
44
|
+
options = {}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// check required parameters
|
|
48
|
+
if (params['name'] == null) {
|
|
49
|
+
const err = new ConfigurationError('Missing required parameter: name')
|
|
50
|
+
return handleError(err, callback)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// validate headers object
|
|
54
|
+
if (options.headers != null && typeof options.headers !== 'object') {
|
|
55
|
+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
|
56
|
+
return handleError(err, callback)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var warnings = []
|
|
60
|
+
var { method, body, name, ...querystring } = params
|
|
61
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
|
62
|
+
|
|
63
|
+
var ignore = options.ignore
|
|
64
|
+
if (typeof ignore === 'number') {
|
|
65
|
+
options.ignore = [ignore]
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var path = ''
|
|
69
|
+
|
|
70
|
+
if (method == null) method = 'DELETE'
|
|
71
|
+
path = '/' + '_index_template' + '/' + encodeURIComponent(name)
|
|
72
|
+
|
|
73
|
+
// build request object
|
|
74
|
+
const request = {
|
|
75
|
+
method,
|
|
76
|
+
path,
|
|
77
|
+
body: body || '',
|
|
78
|
+
querystring
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
options.warnings = warnings.length === 0 ? null : warnings
|
|
82
|
+
return makeRequest(request, options, callback)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
module.exports = buildIndicesDeleteIndexTemplate
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Licensed to Elasticsearch B.V under one or more agreements.
|
|
2
|
+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
|
3
|
+
// See the LICENSE file in the project root for more information
|
|
4
|
+
|
|
5
|
+
'use strict'
|
|
6
|
+
|
|
7
|
+
/* eslint camelcase: 0 */
|
|
8
|
+
/* eslint no-unused-vars: 0 */
|
|
9
|
+
|
|
10
|
+
function buildIndicesExistsIndexTemplate (opts) {
|
|
11
|
+
// eslint-disable-next-line no-unused-vars
|
|
12
|
+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
|
13
|
+
|
|
14
|
+
const acceptedQuerystring = [
|
|
15
|
+
'flat_settings',
|
|
16
|
+
'master_timeout',
|
|
17
|
+
'local',
|
|
18
|
+
'pretty',
|
|
19
|
+
'human',
|
|
20
|
+
'error_trace',
|
|
21
|
+
'source',
|
|
22
|
+
'filter_path'
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const snakeCase = {
|
|
26
|
+
flatSettings: 'flat_settings',
|
|
27
|
+
masterTimeout: 'master_timeout',
|
|
28
|
+
errorTrace: 'error_trace',
|
|
29
|
+
filterPath: 'filter_path'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Perform a indices.exists_index_template request
|
|
34
|
+
* Returns information about whether a particular index template exists.
|
|
35
|
+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
|
|
36
|
+
*/
|
|
37
|
+
return function indicesExistsIndexTemplate (params, options, callback) {
|
|
38
|
+
options = options || {}
|
|
39
|
+
if (typeof options === 'function') {
|
|
40
|
+
callback = options
|
|
41
|
+
options = {}
|
|
42
|
+
}
|
|
43
|
+
if (typeof params === 'function' || params == null) {
|
|
44
|
+
callback = params
|
|
45
|
+
params = {}
|
|
46
|
+
options = {}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// check required parameters
|
|
50
|
+
if (params['name'] == null) {
|
|
51
|
+
const err = new ConfigurationError('Missing required parameter: name')
|
|
52
|
+
return handleError(err, callback)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// validate headers object
|
|
56
|
+
if (options.headers != null && typeof options.headers !== 'object') {
|
|
57
|
+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
|
58
|
+
return handleError(err, callback)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var warnings = []
|
|
62
|
+
var { method, body, name, ...querystring } = params
|
|
63
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
|
64
|
+
|
|
65
|
+
var ignore = options.ignore
|
|
66
|
+
if (typeof ignore === 'number') {
|
|
67
|
+
options.ignore = [ignore]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
var path = ''
|
|
71
|
+
|
|
72
|
+
if (method == null) method = 'HEAD'
|
|
73
|
+
path = '/' + '_index_template' + '/' + encodeURIComponent(name)
|
|
74
|
+
|
|
75
|
+
// build request object
|
|
76
|
+
const request = {
|
|
77
|
+
method,
|
|
78
|
+
path,
|
|
79
|
+
body: null,
|
|
80
|
+
querystring
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
options.warnings = warnings.length === 0 ? null : warnings
|
|
84
|
+
return makeRequest(request, options, callback)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
module.exports = buildIndicesExistsIndexTemplate
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Licensed to Elasticsearch B.V under one or more agreements.
|
|
2
|
+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
|
3
|
+
// See the LICENSE file in the project root for more information
|
|
4
|
+
|
|
5
|
+
'use strict'
|
|
6
|
+
|
|
7
|
+
/* eslint camelcase: 0 */
|
|
8
|
+
/* eslint no-unused-vars: 0 */
|
|
9
|
+
|
|
10
|
+
function buildIndicesGetIndexTemplate (opts) {
|
|
11
|
+
// eslint-disable-next-line no-unused-vars
|
|
12
|
+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
|
13
|
+
|
|
14
|
+
const acceptedQuerystring = [
|
|
15
|
+
'flat_settings',
|
|
16
|
+
'master_timeout',
|
|
17
|
+
'local',
|
|
18
|
+
'pretty',
|
|
19
|
+
'human',
|
|
20
|
+
'error_trace',
|
|
21
|
+
'source',
|
|
22
|
+
'filter_path'
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const snakeCase = {
|
|
26
|
+
flatSettings: 'flat_settings',
|
|
27
|
+
masterTimeout: 'master_timeout',
|
|
28
|
+
errorTrace: 'error_trace',
|
|
29
|
+
filterPath: 'filter_path'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Perform a indices.get_index_template request
|
|
34
|
+
* Returns an index template.
|
|
35
|
+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
|
|
36
|
+
*/
|
|
37
|
+
return function indicesGetIndexTemplate (params, options, callback) {
|
|
38
|
+
options = options || {}
|
|
39
|
+
if (typeof options === 'function') {
|
|
40
|
+
callback = options
|
|
41
|
+
options = {}
|
|
42
|
+
}
|
|
43
|
+
if (typeof params === 'function' || params == null) {
|
|
44
|
+
callback = params
|
|
45
|
+
params = {}
|
|
46
|
+
options = {}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// validate headers object
|
|
50
|
+
if (options.headers != null && typeof options.headers !== 'object') {
|
|
51
|
+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
|
52
|
+
return handleError(err, callback)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var warnings = []
|
|
56
|
+
var { method, body, name, ...querystring } = params
|
|
57
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
|
58
|
+
|
|
59
|
+
var ignore = options.ignore
|
|
60
|
+
if (typeof ignore === 'number') {
|
|
61
|
+
options.ignore = [ignore]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var path = ''
|
|
65
|
+
|
|
66
|
+
if ((name) != null) {
|
|
67
|
+
if (method == null) method = 'GET'
|
|
68
|
+
path = '/' + '_index_template' + '/' + encodeURIComponent(name)
|
|
69
|
+
} else {
|
|
70
|
+
if (method == null) method = 'GET'
|
|
71
|
+
path = '/' + '_index_template'
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// build request object
|
|
75
|
+
const request = {
|
|
76
|
+
method,
|
|
77
|
+
path,
|
|
78
|
+
body: null,
|
|
79
|
+
querystring
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
options.warnings = warnings.length === 0 ? null : warnings
|
|
83
|
+
return makeRequest(request, options, callback)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
module.exports = buildIndicesGetIndexTemplate
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Licensed to Elasticsearch B.V under one or more agreements.
|
|
2
|
+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
|
3
|
+
// See the LICENSE file in the project root for more information
|
|
4
|
+
|
|
5
|
+
'use strict'
|
|
6
|
+
|
|
7
|
+
/* eslint camelcase: 0 */
|
|
8
|
+
/* eslint no-unused-vars: 0 */
|
|
9
|
+
|
|
10
|
+
function buildIndicesPutIndexTemplate (opts) {
|
|
11
|
+
// eslint-disable-next-line no-unused-vars
|
|
12
|
+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
|
13
|
+
|
|
14
|
+
const acceptedQuerystring = [
|
|
15
|
+
'create',
|
|
16
|
+
'cause',
|
|
17
|
+
'master_timeout',
|
|
18
|
+
'pretty',
|
|
19
|
+
'human',
|
|
20
|
+
'error_trace',
|
|
21
|
+
'source',
|
|
22
|
+
'filter_path'
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const snakeCase = {
|
|
26
|
+
masterTimeout: 'master_timeout',
|
|
27
|
+
errorTrace: 'error_trace',
|
|
28
|
+
filterPath: 'filter_path'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Perform a indices.put_index_template request
|
|
33
|
+
* Creates or updates an index template.
|
|
34
|
+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
|
|
35
|
+
*/
|
|
36
|
+
return function indicesPutIndexTemplate (params, options, callback) {
|
|
37
|
+
options = options || {}
|
|
38
|
+
if (typeof options === 'function') {
|
|
39
|
+
callback = options
|
|
40
|
+
options = {}
|
|
41
|
+
}
|
|
42
|
+
if (typeof params === 'function' || params == null) {
|
|
43
|
+
callback = params
|
|
44
|
+
params = {}
|
|
45
|
+
options = {}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// check required parameters
|
|
49
|
+
if (params['name'] == null) {
|
|
50
|
+
const err = new ConfigurationError('Missing required parameter: name')
|
|
51
|
+
return handleError(err, callback)
|
|
52
|
+
}
|
|
53
|
+
if (params['body'] == null) {
|
|
54
|
+
const err = new ConfigurationError('Missing required parameter: body')
|
|
55
|
+
return handleError(err, callback)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// validate headers object
|
|
59
|
+
if (options.headers != null && typeof options.headers !== 'object') {
|
|
60
|
+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
|
61
|
+
return handleError(err, callback)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var warnings = []
|
|
65
|
+
var { method, body, name, ...querystring } = params
|
|
66
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
|
67
|
+
|
|
68
|
+
var ignore = options.ignore
|
|
69
|
+
if (typeof ignore === 'number') {
|
|
70
|
+
options.ignore = [ignore]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var path = ''
|
|
74
|
+
|
|
75
|
+
if (method == null) method = 'PUT'
|
|
76
|
+
path = '/' + '_index_template' + '/' + encodeURIComponent(name)
|
|
77
|
+
|
|
78
|
+
// build request object
|
|
79
|
+
const request = {
|
|
80
|
+
method,
|
|
81
|
+
path,
|
|
82
|
+
body: body || '',
|
|
83
|
+
querystring
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
options.warnings = warnings.length === 0 ? null : warnings
|
|
87
|
+
return makeRequest(request, options, callback)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = buildIndicesPutIndexTemplate
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Licensed to Elasticsearch B.V under one or more agreements.
|
|
2
|
+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
|
3
|
+
// See the LICENSE file in the project root for more information
|
|
4
|
+
|
|
5
|
+
'use strict'
|
|
6
|
+
|
|
7
|
+
/* eslint camelcase: 0 */
|
|
8
|
+
/* eslint no-unused-vars: 0 */
|
|
9
|
+
|
|
10
|
+
function buildIndicesSimulateIndexTemplate (opts) {
|
|
11
|
+
// eslint-disable-next-line no-unused-vars
|
|
12
|
+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
|
13
|
+
|
|
14
|
+
const acceptedQuerystring = [
|
|
15
|
+
'create',
|
|
16
|
+
'cause',
|
|
17
|
+
'master_timeout',
|
|
18
|
+
'pretty',
|
|
19
|
+
'human',
|
|
20
|
+
'error_trace',
|
|
21
|
+
'source',
|
|
22
|
+
'filter_path'
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const snakeCase = {
|
|
26
|
+
masterTimeout: 'master_timeout',
|
|
27
|
+
errorTrace: 'error_trace',
|
|
28
|
+
filterPath: 'filter_path'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Perform a indices.simulate_index_template request
|
|
33
|
+
* Simulate matching the given index name against the index templates in the system
|
|
34
|
+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
|
|
35
|
+
*/
|
|
36
|
+
return function indicesSimulateIndexTemplate (params, options, callback) {
|
|
37
|
+
options = options || {}
|
|
38
|
+
if (typeof options === 'function') {
|
|
39
|
+
callback = options
|
|
40
|
+
options = {}
|
|
41
|
+
}
|
|
42
|
+
if (typeof params === 'function' || params == null) {
|
|
43
|
+
callback = params
|
|
44
|
+
params = {}
|
|
45
|
+
options = {}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// check required parameters
|
|
49
|
+
if (params['name'] == null) {
|
|
50
|
+
const err = new ConfigurationError('Missing required parameter: name')
|
|
51
|
+
return handleError(err, callback)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// validate headers object
|
|
55
|
+
if (options.headers != null && typeof options.headers !== 'object') {
|
|
56
|
+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
|
57
|
+
return handleError(err, callback)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var warnings = []
|
|
61
|
+
var { method, body, name, ...querystring } = params
|
|
62
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
|
63
|
+
|
|
64
|
+
var ignore = options.ignore
|
|
65
|
+
if (typeof ignore === 'number') {
|
|
66
|
+
options.ignore = [ignore]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
var path = ''
|
|
70
|
+
|
|
71
|
+
if (method == null) method = 'POST'
|
|
72
|
+
path = '/' + '_index_template' + '/' + '_simulate_index' + '/' + encodeURIComponent(name)
|
|
73
|
+
|
|
74
|
+
// build request object
|
|
75
|
+
const request = {
|
|
76
|
+
method,
|
|
77
|
+
path,
|
|
78
|
+
body: body || '',
|
|
79
|
+
querystring
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
options.warnings = warnings.length === 0 ? null : warnings
|
|
83
|
+
return makeRequest(request, options, callback)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
module.exports = buildIndicesSimulateIndexTemplate
|
package/api/api/mget.js
CHANGED
|
@@ -19,7 +19,9 @@ function buildMget (opts) {
|
|
|
19
19
|
'routing',
|
|
20
20
|
'_source',
|
|
21
21
|
'_source_excludes',
|
|
22
|
+
'_source_exclude',
|
|
22
23
|
'_source_includes',
|
|
24
|
+
'_source_include',
|
|
23
25
|
'pretty',
|
|
24
26
|
'human',
|
|
25
27
|
'error_trace',
|
|
@@ -30,7 +32,9 @@ function buildMget (opts) {
|
|
|
30
32
|
const snakeCase = {
|
|
31
33
|
storedFields: 'stored_fields',
|
|
32
34
|
_sourceExcludes: '_source_excludes',
|
|
35
|
+
_sourceExclude: '_source_exclude',
|
|
33
36
|
_sourceIncludes: '_source_includes',
|
|
37
|
+
_sourceInclude: '_source_include',
|
|
34
38
|
errorTrace: 'error_trace',
|
|
35
39
|
filterPath: 'filter_path'
|
|
36
40
|
}
|
package/api/api/ml.validate.js
CHANGED
|
@@ -22,6 +22,7 @@ function buildMlValidate (opts) {
|
|
|
22
22
|
/**
|
|
23
23
|
* Perform a ml.validate request
|
|
24
24
|
* Validates an anomaly detection job.
|
|
25
|
+
* https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html
|
|
25
26
|
*/
|
|
26
27
|
return function mlValidate (params, options, callback) {
|
|
27
28
|
options = options || {}
|
|
@@ -22,6 +22,7 @@ function buildMlValidateDetector (opts) {
|
|
|
22
22
|
/**
|
|
23
23
|
* Perform a ml.validate_detector request
|
|
24
24
|
* Validates an anomaly detection detector.
|
|
25
|
+
* https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html
|
|
25
26
|
*/
|
|
26
27
|
return function mlValidateDetector (params, options, callback) {
|
|
27
28
|
options = options || {}
|
package/api/api/search.js
CHANGED
|
@@ -35,7 +35,9 @@ function buildSearch (opts) {
|
|
|
35
35
|
'sort',
|
|
36
36
|
'_source',
|
|
37
37
|
'_source_excludes',
|
|
38
|
+
'_source_exclude',
|
|
38
39
|
'_source_includes',
|
|
40
|
+
'_source_include',
|
|
39
41
|
'terminate_after',
|
|
40
42
|
'stats',
|
|
41
43
|
'suggest_field',
|
|
@@ -73,7 +75,9 @@ function buildSearch (opts) {
|
|
|
73
75
|
expandWildcards: 'expand_wildcards',
|
|
74
76
|
searchType: 'search_type',
|
|
75
77
|
_sourceExcludes: '_source_excludes',
|
|
78
|
+
_sourceExclude: '_source_exclude',
|
|
76
79
|
_sourceIncludes: '_source_includes',
|
|
80
|
+
_sourceInclude: '_source_include',
|
|
77
81
|
terminateAfter: 'terminate_after',
|
|
78
82
|
suggestField: 'suggest_field',
|
|
79
83
|
suggestMode: 'suggest_mode',
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Licensed to Elasticsearch B.V under one or more agreements.
|
|
2
|
+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
|
3
|
+
// See the LICENSE file in the project root for more information
|
|
4
|
+
|
|
5
|
+
'use strict'
|
|
6
|
+
|
|
7
|
+
/* eslint camelcase: 0 */
|
|
8
|
+
/* eslint no-unused-vars: 0 */
|
|
9
|
+
|
|
10
|
+
function buildSearchableSnapshotsClearCache (opts) {
|
|
11
|
+
// eslint-disable-next-line no-unused-vars
|
|
12
|
+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
|
13
|
+
|
|
14
|
+
const acceptedQuerystring = [
|
|
15
|
+
'ignore_unavailable',
|
|
16
|
+
'allow_no_indices',
|
|
17
|
+
'expand_wildcards',
|
|
18
|
+
'index'
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
const snakeCase = {
|
|
22
|
+
ignoreUnavailable: 'ignore_unavailable',
|
|
23
|
+
allowNoIndices: 'allow_no_indices',
|
|
24
|
+
expandWildcards: 'expand_wildcards'
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Perform a searchable_snapshots.clear_cache request
|
|
30
|
+
* Clear the cache of searchable snapshots.
|
|
31
|
+
* https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-clear-cache.html
|
|
32
|
+
*/
|
|
33
|
+
return function searchableSnapshotsClearCache (params, options, callback) {
|
|
34
|
+
options = options || {}
|
|
35
|
+
if (typeof options === 'function') {
|
|
36
|
+
callback = options
|
|
37
|
+
options = {}
|
|
38
|
+
}
|
|
39
|
+
if (typeof params === 'function' || params == null) {
|
|
40
|
+
callback = params
|
|
41
|
+
params = {}
|
|
42
|
+
options = {}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// validate headers object
|
|
46
|
+
if (options.headers != null && typeof options.headers !== 'object') {
|
|
47
|
+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
|
48
|
+
return handleError(err, callback)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var warnings = []
|
|
52
|
+
var { method, body, index, ...querystring } = params
|
|
53
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
|
54
|
+
|
|
55
|
+
var ignore = options.ignore
|
|
56
|
+
if (typeof ignore === 'number') {
|
|
57
|
+
options.ignore = [ignore]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var path = ''
|
|
61
|
+
|
|
62
|
+
if ((index) != null) {
|
|
63
|
+
if (method == null) method = 'POST'
|
|
64
|
+
path = '/' + encodeURIComponent(index) + '/' + '_searchable_snapshots' + '/' + 'cache' + '/' + 'clear'
|
|
65
|
+
} else {
|
|
66
|
+
if (method == null) method = 'POST'
|
|
67
|
+
path = '/' + '_searchable_snapshots' + '/' + 'cache' + '/' + 'clear'
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// build request object
|
|
71
|
+
const request = {
|
|
72
|
+
method,
|
|
73
|
+
path,
|
|
74
|
+
body: body || '',
|
|
75
|
+
querystring
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
options.warnings = warnings.length === 0 ? null : warnings
|
|
79
|
+
return makeRequest(request, options, callback)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
module.exports = buildSearchableSnapshotsClearCache
|