Skip to content

Commit 8bd5c4c

Browse files
authored
Support for Elasticsearch 7.6 (#1075)
1 parent d19313a commit 8bd5c4c

25 files changed

+993
-51
lines changed

.ci/test-matrix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
ELASTICSEARCH_VERSION:
3-
- 7.5.0
3+
- 7.6-SNAPSHOT
44

55
NODE_JS_VERSION:
66
- 12

api/api/get_script_context.js

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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 buildGetScriptContext (opts) {
11+
// eslint-disable-next-line no-unused-vars
12+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13+
14+
const acceptedQuerystring = [
15+
'pretty',
16+
'human',
17+
'error_trace',
18+
'source',
19+
'filter_path'
20+
]
21+
22+
const snakeCase = {
23+
errorTrace: 'error_trace',
24+
filterPath: 'filter_path'
25+
}
26+
27+
/**
28+
* Perform a get_script_context request
29+
* Returns all script contexts.
30+
*/
31+
return function getScriptContext (params, options, callback) {
32+
options = options || {}
33+
if (typeof options === 'function') {
34+
callback = options
35+
options = {}
36+
}
37+
if (typeof params === 'function' || params == null) {
38+
callback = params
39+
params = {}
40+
options = {}
41+
}
42+
43+
// validate headers object
44+
if (options.headers != null && typeof options.headers !== 'object') {
45+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
46+
return handleError(err, callback)
47+
}
48+
49+
var warnings = []
50+
var { method, body, ...querystring } = params
51+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
52+
53+
var ignore = options.ignore
54+
if (typeof ignore === 'number') {
55+
options.ignore = [ignore]
56+
}
57+
58+
var path = ''
59+
60+
if (method == null) method = 'GET'
61+
path = '/' + '_script_context'
62+
63+
// build request object
64+
const request = {
65+
method,
66+
path,
67+
body: null,
68+
querystring
69+
}
70+
71+
options.warnings = warnings.length === 0 ? null : warnings
72+
return makeRequest(request, options, callback)
73+
}
74+
}
75+
76+
module.exports = buildGetScriptContext

api/api/get_script_languages.js

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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 buildGetScriptLanguages (opts) {
11+
// eslint-disable-next-line no-unused-vars
12+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13+
14+
const acceptedQuerystring = [
15+
'pretty',
16+
'human',
17+
'error_trace',
18+
'source',
19+
'filter_path'
20+
]
21+
22+
const snakeCase = {
23+
errorTrace: 'error_trace',
24+
filterPath: 'filter_path'
25+
}
26+
27+
/**
28+
* Perform a get_script_languages request
29+
* Returns available script types, languages and contexts
30+
*/
31+
return function getScriptLanguages (params, options, callback) {
32+
options = options || {}
33+
if (typeof options === 'function') {
34+
callback = options
35+
options = {}
36+
}
37+
if (typeof params === 'function' || params == null) {
38+
callback = params
39+
params = {}
40+
options = {}
41+
}
42+
43+
// validate headers object
44+
if (options.headers != null && typeof options.headers !== 'object') {
45+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
46+
return handleError(err, callback)
47+
}
48+
49+
var warnings = []
50+
var { method, body, ...querystring } = params
51+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
52+
53+
var ignore = options.ignore
54+
if (typeof ignore === 'number') {
55+
options.ignore = [ignore]
56+
}
57+
58+
var path = ''
59+
60+
if (method == null) method = 'GET'
61+
path = '/' + '_script_language'
62+
63+
// build request object
64+
const request = {
65+
method,
66+
path,
67+
body: null,
68+
querystring
69+
}
70+
71+
options.warnings = warnings.length === 0 ? null : warnings
72+
return makeRequest(request, options, callback)
73+
}
74+
}
75+
76+
module.exports = buildGetScriptLanguages

api/api/indices.flush_synced.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function buildIndicesFlushSynced (opts) {
3232

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

api/api/license.get.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ function buildLicenseGet (opts) {
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
1313

1414
const acceptedQuerystring = [
15-
'local'
15+
'local',
16+
'accept_enterprise'
1617
]
1718

1819
const snakeCase = {
19-
20+
acceptEnterprise: 'accept_enterprise'
2021
}
2122

2223
/**

api/api/ml.delete_data_frame_analytics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function buildMlDeleteDataFrameAnalytics (opts) {
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
1313

1414
const acceptedQuerystring = [
15-
15+
'force'
1616
]
1717

1818
const snakeCase = {

api/api/ml.delete_trained_model.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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 buildMlDeleteTrainedModel (opts) {
11+
// eslint-disable-next-line no-unused-vars
12+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13+
14+
const acceptedQuerystring = [
15+
16+
]
17+
18+
const snakeCase = {
19+
20+
}
21+
22+
/**
23+
* Perform a ml.delete_trained_model request
24+
* https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference.html
25+
*/
26+
return function mlDeleteTrainedModel (params, options, callback) {
27+
options = options || {}
28+
if (typeof options === 'function') {
29+
callback = options
30+
options = {}
31+
}
32+
if (typeof params === 'function' || params == null) {
33+
callback = params
34+
params = {}
35+
options = {}
36+
}
37+
38+
// check required parameters
39+
if (params['model_id'] == null && params['modelId'] == null) {
40+
const err = new ConfigurationError('Missing required parameter: model_id or modelId')
41+
return handleError(err, callback)
42+
}
43+
44+
// validate headers object
45+
if (options.headers != null && typeof options.headers !== 'object') {
46+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
47+
return handleError(err, callback)
48+
}
49+
50+
var warnings = []
51+
var { method, body, modelId, model_id, ...querystring } = params
52+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
53+
54+
var ignore = options.ignore
55+
if (typeof ignore === 'number') {
56+
options.ignore = [ignore]
57+
}
58+
59+
var path = ''
60+
61+
if (method == null) method = 'DELETE'
62+
path = '/' + '_ml' + '/' + 'inference' + '/' + encodeURIComponent(model_id || modelId)
63+
64+
// build request object
65+
const request = {
66+
method,
67+
path,
68+
body: body || '',
69+
querystring
70+
}
71+
72+
options.warnings = warnings.length === 0 ? null : warnings
73+
return makeRequest(request, options, callback)
74+
}
75+
}
76+
77+
module.exports = buildMlDeleteTrainedModel
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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 buildMlExplainDataFrameAnalytics (opts) {
11+
// eslint-disable-next-line no-unused-vars
12+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13+
14+
const acceptedQuerystring = [
15+
16+
]
17+
18+
const snakeCase = {
19+
20+
}
21+
22+
/**
23+
* Perform a ml.explain_data_frame_analytics request
24+
* http://www.elastic.co/guide/en/elasticsearch/reference/current/explain-dfanalytics.html
25+
*/
26+
return function mlExplainDataFrameAnalytics (params, options, callback) {
27+
options = options || {}
28+
if (typeof options === 'function') {
29+
callback = options
30+
options = {}
31+
}
32+
if (typeof params === 'function' || params == null) {
33+
callback = params
34+
params = {}
35+
options = {}
36+
}
37+
38+
// validate headers object
39+
if (options.headers != null && typeof options.headers !== 'object') {
40+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
41+
return handleError(err, callback)
42+
}
43+
44+
var warnings = []
45+
var { method, body, id, ...querystring } = params
46+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
47+
48+
var ignore = options.ignore
49+
if (typeof ignore === 'number') {
50+
options.ignore = [ignore]
51+
}
52+
53+
var path = ''
54+
55+
if ((id) != null) {
56+
if (method == null) method = body == null ? 'GET' : 'POST'
57+
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_explain'
58+
} else {
59+
if (method == null) method = body == null ? 'GET' : 'POST'
60+
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + '_explain'
61+
}
62+
63+
// build request object
64+
const request = {
65+
method,
66+
path,
67+
body: body || '',
68+
querystring
69+
}
70+
71+
options.warnings = warnings.length === 0 ? null : warnings
72+
return makeRequest(request, options, callback)
73+
}
74+
}
75+
76+
module.exports = buildMlExplainDataFrameAnalytics

0 commit comments

Comments
 (0)