@elastic/elasticsearch 7.15.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/.dockerignore +5 -0
- package/LICENSE +202 -0
- package/README.md +232 -0
- package/api/api/async_search.js +141 -0
- package/api/api/autoscaling.js +147 -0
- package/api/api/bulk.js +70 -0
- package/api/api/cat.js +648 -0
- package/api/api/ccr.js +403 -0
- package/api/api/clear_scroll.js +55 -0
- package/api/api/close_point_in_time.js +50 -0
- package/api/api/cluster.js +420 -0
- package/api/api/count.js +64 -0
- package/api/api/create.js +69 -0
- package/api/api/dangling_indices.js +115 -0
- package/api/api/delete.js +65 -0
- package/api/api/delete_by_query.js +71 -0
- package/api/api/delete_by_query_rethrottle.js +60 -0
- package/api/api/delete_script.js +56 -0
- package/api/api/enrich.js +173 -0
- package/api/api/eql.js +150 -0
- package/api/api/exists.js +65 -0
- package/api/api/exists_source.js +74 -0
- package/api/api/explain.js +65 -0
- package/api/api/features.js +81 -0
- package/api/api/field_caps.js +55 -0
- package/api/api/fleet.js +65 -0
- package/api/api/get.js +65 -0
- package/api/api/get_script.js +56 -0
- package/api/api/get_script_context.js +50 -0
- package/api/api/get_script_languages.js +50 -0
- package/api/api/get_source.js +65 -0
- package/api/api/graph.js +72 -0
- package/api/api/ilm.js +317 -0
- package/api/api/index.js +71 -0
- package/api/api/indices.js +1753 -0
- package/api/api/info.js +50 -0
- package/api/api/ingest.js +200 -0
- package/api/api/license.js +188 -0
- package/api/api/logstash.js +125 -0
- package/api/api/mget.js +70 -0
- package/api/api/migration.js +60 -0
- package/api/api/ml.js +2010 -0
- package/api/api/monitoring.js +66 -0
- package/api/api/msearch.js +70 -0
- package/api/api/msearch_template.js +70 -0
- package/api/api/mtermvectors.js +64 -0
- package/api/api/nodes.js +268 -0
- package/api/api/open_point_in_time.js +56 -0
- package/api/api/ping.js +50 -0
- package/api/api/put_script.js +71 -0
- package/api/api/rank_eval.js +61 -0
- package/api/api/reindex.js +56 -0
- package/api/api/reindex_rethrottle.js +60 -0
- package/api/api/render_search_template.js +55 -0
- package/api/api/rollup.js +319 -0
- package/api/api/scripts_painless_execute.js +50 -0
- package/api/api/scroll.js +55 -0
- package/api/api/search.js +64 -0
- package/api/api/search_mvt.js +87 -0
- package/api/api/search_shards.js +55 -0
- package/api/api/search_template.js +70 -0
- package/api/api/searchable_snapshots.js +186 -0
- package/api/api/security.js +1261 -0
- package/api/api/shutdown.js +124 -0
- package/api/api/slm.js +256 -0
- package/api/api/snapshot.js +439 -0
- package/api/api/sql.js +203 -0
- package/api/api/ssl.js +55 -0
- package/api/api/tasks.js +108 -0
- package/api/api/terms_enum.js +56 -0
- package/api/api/termvectors.js +67 -0
- package/api/api/text_structure.js +65 -0
- package/api/api/transform.js +268 -0
- package/api/api/update.js +69 -0
- package/api/api/update_by_query.js +67 -0
- package/api/api/update_by_query_rethrottle.js +60 -0
- package/api/api/watcher.js +333 -0
- package/api/api/xpack.js +76 -0
- package/api/index.js +508 -0
- package/api/new.d.ts +1585 -0
- package/api/requestParams.d.ts +2920 -0
- package/api/types.d.ts +15420 -0
- package/api/utils.js +58 -0
- package/codecov.yml +14 -0
- package/index.d.ts +2991 -0
- package/index.js +349 -0
- package/index.mjs +29 -0
- package/lib/Connection.d.ts +99 -0
- package/lib/Connection.js +392 -0
- package/lib/Helpers.d.ts +124 -0
- package/lib/Helpers.js +770 -0
- package/lib/Serializer.d.ts +30 -0
- package/lib/Serializer.js +94 -0
- package/lib/Transport.d.ts +162 -0
- package/lib/Transport.js +689 -0
- package/lib/errors.d.ts +90 -0
- package/lib/errors.js +159 -0
- package/lib/pool/BaseConnectionPool.js +262 -0
- package/lib/pool/CloudConnectionPool.js +64 -0
- package/lib/pool/ConnectionPool.js +246 -0
- package/lib/pool/index.d.ts +220 -0
- package/lib/pool/index.js +30 -0
- package/package.json +106 -0
package/api/api/tasks.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
3
|
+
* license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright
|
|
5
|
+
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
6
|
+
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
* not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict'
|
|
21
|
+
|
|
22
|
+
/* eslint camelcase: 0 */
|
|
23
|
+
/* eslint no-unused-vars: 0 */
|
|
24
|
+
|
|
25
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
+
const acceptedQuerystring = ['nodes', 'actions', 'parent_task_id', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'timeout', 'detailed', 'group_by']
|
|
27
|
+
const snakeCase = { parentTaskId: 'parent_task_id', waitForCompletion: 'wait_for_completion', errorTrace: 'error_trace', filterPath: 'filter_path', groupBy: 'group_by' }
|
|
28
|
+
|
|
29
|
+
function TasksApi (transport, ConfigurationError) {
|
|
30
|
+
this.transport = transport
|
|
31
|
+
this[kConfigurationError] = ConfigurationError
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
TasksApi.prototype.cancel = function tasksCancelApi (params, options, callback) {
|
|
35
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
36
|
+
|
|
37
|
+
let { method, body, taskId, task_id, ...querystring } = params
|
|
38
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
39
|
+
|
|
40
|
+
let path = ''
|
|
41
|
+
if ((task_id || taskId) != null) {
|
|
42
|
+
if (method == null) method = 'POST'
|
|
43
|
+
path = '/' + '_tasks' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_cancel'
|
|
44
|
+
} else {
|
|
45
|
+
if (method == null) method = 'POST'
|
|
46
|
+
path = '/' + '_tasks' + '/' + '_cancel'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// build request object
|
|
50
|
+
const request = {
|
|
51
|
+
method,
|
|
52
|
+
path,
|
|
53
|
+
body: body || '',
|
|
54
|
+
querystring
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return this.transport.request(request, options, callback)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
TasksApi.prototype.get = function tasksGetApi (params, options, callback) {
|
|
61
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
62
|
+
|
|
63
|
+
// check required parameters
|
|
64
|
+
if (params.task_id == null && params.taskId == null) {
|
|
65
|
+
const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId')
|
|
66
|
+
return handleError(err, callback)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let { method, body, taskId, task_id, ...querystring } = params
|
|
70
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
71
|
+
|
|
72
|
+
let path = ''
|
|
73
|
+
if (method == null) method = 'GET'
|
|
74
|
+
path = '/' + '_tasks' + '/' + encodeURIComponent(task_id || taskId)
|
|
75
|
+
|
|
76
|
+
// build request object
|
|
77
|
+
const request = {
|
|
78
|
+
method,
|
|
79
|
+
path,
|
|
80
|
+
body: null,
|
|
81
|
+
querystring
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return this.transport.request(request, options, callback)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
TasksApi.prototype.list = function tasksListApi (params, options, callback) {
|
|
88
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
89
|
+
|
|
90
|
+
let { method, body, ...querystring } = params
|
|
91
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
92
|
+
|
|
93
|
+
let path = ''
|
|
94
|
+
if (method == null) method = 'GET'
|
|
95
|
+
path = '/' + '_tasks'
|
|
96
|
+
|
|
97
|
+
// build request object
|
|
98
|
+
const request = {
|
|
99
|
+
method,
|
|
100
|
+
path,
|
|
101
|
+
body: null,
|
|
102
|
+
querystring
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return this.transport.request(request, options, callback)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
module.exports = TasksApi
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
3
|
+
* license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright
|
|
5
|
+
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
6
|
+
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
* not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict'
|
|
21
|
+
|
|
22
|
+
/* eslint camelcase: 0 */
|
|
23
|
+
/* eslint no-unused-vars: 0 */
|
|
24
|
+
|
|
25
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
+
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function termsEnumApi (params, options, callback) {
|
|
30
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
31
|
+
|
|
32
|
+
// check required parameters
|
|
33
|
+
if (params.index == null) {
|
|
34
|
+
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
35
|
+
return handleError(err, callback)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let { method, body, index, ...querystring } = params
|
|
39
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
40
|
+
|
|
41
|
+
let path = ''
|
|
42
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
43
|
+
path = '/' + encodeURIComponent(index) + '/' + '_terms_enum'
|
|
44
|
+
|
|
45
|
+
// build request object
|
|
46
|
+
const request = {
|
|
47
|
+
method,
|
|
48
|
+
path,
|
|
49
|
+
body: body || '',
|
|
50
|
+
querystring
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return this.transport.request(request, options, callback)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = termsEnumApi
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
3
|
+
* license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright
|
|
5
|
+
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
6
|
+
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
* not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict'
|
|
21
|
+
|
|
22
|
+
/* eslint camelcase: 0 */
|
|
23
|
+
/* eslint no-unused-vars: 0 */
|
|
24
|
+
|
|
25
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
+
const acceptedQuerystring = ['term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { termStatistics: 'term_statistics', fieldStatistics: 'field_statistics', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function termvectorsApi (params, options, callback) {
|
|
30
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
31
|
+
|
|
32
|
+
// check required parameters
|
|
33
|
+
if (params.index == null) {
|
|
34
|
+
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
35
|
+
return handleError(err, callback)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let { method, body, index, id, type, ...querystring } = params
|
|
39
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
40
|
+
|
|
41
|
+
let path = ''
|
|
42
|
+
if ((index) != null && (type) != null && (id) != null) {
|
|
43
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
44
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_termvectors'
|
|
45
|
+
} else if ((index) != null && (id) != null) {
|
|
46
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
47
|
+
path = '/' + encodeURIComponent(index) + '/' + '_termvectors' + '/' + encodeURIComponent(id)
|
|
48
|
+
} else if ((index) != null && (type) != null) {
|
|
49
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
50
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors'
|
|
51
|
+
} else {
|
|
52
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
53
|
+
path = '/' + encodeURIComponent(index) + '/' + '_termvectors'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// build request object
|
|
57
|
+
const request = {
|
|
58
|
+
method,
|
|
59
|
+
path,
|
|
60
|
+
body: body || '',
|
|
61
|
+
querystring
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return this.transport.request(request, options, callback)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = termvectorsApi
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
3
|
+
* license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright
|
|
5
|
+
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
6
|
+
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
* not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict'
|
|
21
|
+
|
|
22
|
+
/* eslint camelcase: 0 */
|
|
23
|
+
/* eslint no-unused-vars: 0 */
|
|
24
|
+
|
|
25
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
+
const acceptedQuerystring = ['lines_to_sample', 'line_merge_size_limit', 'timeout', 'charset', 'format', 'has_header_row', 'column_names', 'delimiter', 'quote', 'should_trim_fields', 'grok_pattern', 'timestamp_field', 'timestamp_format', 'explain', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { linesToSample: 'lines_to_sample', lineMergeSizeLimit: 'line_merge_size_limit', hasHeaderRow: 'has_header_row', columnNames: 'column_names', shouldTrimFields: 'should_trim_fields', grokPattern: 'grok_pattern', timestampField: 'timestamp_field', timestampFormat: 'timestamp_format', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function TextStructureApi (transport, ConfigurationError) {
|
|
30
|
+
this.transport = transport
|
|
31
|
+
this[kConfigurationError] = ConfigurationError
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
TextStructureApi.prototype.findStructure = function textStructureFindStructureApi (params, options, callback) {
|
|
35
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
36
|
+
|
|
37
|
+
// check required parameters
|
|
38
|
+
if (params.body == null) {
|
|
39
|
+
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
40
|
+
return handleError(err, callback)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let { method, body, ...querystring } = params
|
|
44
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
45
|
+
|
|
46
|
+
let path = ''
|
|
47
|
+
if (method == null) method = 'POST'
|
|
48
|
+
path = '/' + '_text_structure' + '/' + 'find_structure'
|
|
49
|
+
|
|
50
|
+
// build request object
|
|
51
|
+
const request = {
|
|
52
|
+
method,
|
|
53
|
+
path,
|
|
54
|
+
bulkBody: body,
|
|
55
|
+
querystring
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return this.transport.request(request, options, callback)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Object.defineProperties(TextStructureApi.prototype, {
|
|
62
|
+
find_structure: { get () { return this.findStructure } }
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
module.exports = TextStructureApi
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
3
|
+
* license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright
|
|
5
|
+
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
6
|
+
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
* not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict'
|
|
21
|
+
|
|
22
|
+
/* eslint camelcase: 0 */
|
|
23
|
+
/* eslint no-unused-vars: 0 */
|
|
24
|
+
|
|
25
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
+
const acceptedQuerystring = ['force', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'from', 'size', 'allow_no_match', 'exclude_generated', 'defer_validation', 'timeout', 'wait_for_completion', 'wait_for_checkpoint']
|
|
27
|
+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', allowNoMatch: 'allow_no_match', excludeGenerated: 'exclude_generated', deferValidation: 'defer_validation', waitForCompletion: 'wait_for_completion', waitForCheckpoint: 'wait_for_checkpoint' }
|
|
28
|
+
|
|
29
|
+
function TransformApi (transport, ConfigurationError) {
|
|
30
|
+
this.transport = transport
|
|
31
|
+
this[kConfigurationError] = ConfigurationError
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
TransformApi.prototype.deleteTransform = function transformDeleteTransformApi (params, options, callback) {
|
|
35
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
36
|
+
|
|
37
|
+
// check required parameters
|
|
38
|
+
if (params.transform_id == null && params.transformId == null) {
|
|
39
|
+
const err = new this[kConfigurationError]('Missing required parameter: transform_id or transformId')
|
|
40
|
+
return handleError(err, callback)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let { method, body, transformId, transform_id, ...querystring } = params
|
|
44
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
45
|
+
|
|
46
|
+
let path = ''
|
|
47
|
+
if (method == null) method = 'DELETE'
|
|
48
|
+
path = '/' + '_transform' + '/' + encodeURIComponent(transform_id || transformId)
|
|
49
|
+
|
|
50
|
+
// build request object
|
|
51
|
+
const request = {
|
|
52
|
+
method,
|
|
53
|
+
path,
|
|
54
|
+
body: body || '',
|
|
55
|
+
querystring
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return this.transport.request(request, options, callback)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
TransformApi.prototype.getTransform = function transformGetTransformApi (params, options, callback) {
|
|
62
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
63
|
+
|
|
64
|
+
let { method, body, transformId, transform_id, ...querystring } = params
|
|
65
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
66
|
+
|
|
67
|
+
let path = ''
|
|
68
|
+
if ((transform_id || transformId) != null) {
|
|
69
|
+
if (method == null) method = 'GET'
|
|
70
|
+
path = '/' + '_transform' + '/' + encodeURIComponent(transform_id || transformId)
|
|
71
|
+
} else {
|
|
72
|
+
if (method == null) method = 'GET'
|
|
73
|
+
path = '/' + '_transform'
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// build request object
|
|
77
|
+
const request = {
|
|
78
|
+
method,
|
|
79
|
+
path,
|
|
80
|
+
body: null,
|
|
81
|
+
querystring
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return this.transport.request(request, options, callback)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
TransformApi.prototype.getTransformStats = function transformGetTransformStatsApi (params, options, callback) {
|
|
88
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
89
|
+
|
|
90
|
+
// check required parameters
|
|
91
|
+
if (params.transform_id == null && params.transformId == null) {
|
|
92
|
+
const err = new this[kConfigurationError]('Missing required parameter: transform_id or transformId')
|
|
93
|
+
return handleError(err, callback)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let { method, body, transformId, transform_id, ...querystring } = params
|
|
97
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
98
|
+
|
|
99
|
+
let path = ''
|
|
100
|
+
if (method == null) method = 'GET'
|
|
101
|
+
path = '/' + '_transform' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_stats'
|
|
102
|
+
|
|
103
|
+
// build request object
|
|
104
|
+
const request = {
|
|
105
|
+
method,
|
|
106
|
+
path,
|
|
107
|
+
body: null,
|
|
108
|
+
querystring
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return this.transport.request(request, options, callback)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
TransformApi.prototype.previewTransform = function transformPreviewTransformApi (params, options, callback) {
|
|
115
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
116
|
+
|
|
117
|
+
// check required parameters
|
|
118
|
+
if (params.body == null) {
|
|
119
|
+
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
120
|
+
return handleError(err, callback)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
let { method, body, ...querystring } = params
|
|
124
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
125
|
+
|
|
126
|
+
let path = ''
|
|
127
|
+
if (method == null) method = 'POST'
|
|
128
|
+
path = '/' + '_transform' + '/' + '_preview'
|
|
129
|
+
|
|
130
|
+
// build request object
|
|
131
|
+
const request = {
|
|
132
|
+
method,
|
|
133
|
+
path,
|
|
134
|
+
body: body || '',
|
|
135
|
+
querystring
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return this.transport.request(request, options, callback)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
TransformApi.prototype.putTransform = function transformPutTransformApi (params, options, callback) {
|
|
142
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
143
|
+
|
|
144
|
+
// check required parameters
|
|
145
|
+
if (params.transform_id == null && params.transformId == null) {
|
|
146
|
+
const err = new this[kConfigurationError]('Missing required parameter: transform_id or transformId')
|
|
147
|
+
return handleError(err, callback)
|
|
148
|
+
}
|
|
149
|
+
if (params.body == null) {
|
|
150
|
+
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
151
|
+
return handleError(err, callback)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
let { method, body, transformId, transform_id, ...querystring } = params
|
|
155
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
156
|
+
|
|
157
|
+
let path = ''
|
|
158
|
+
if (method == null) method = 'PUT'
|
|
159
|
+
path = '/' + '_transform' + '/' + encodeURIComponent(transform_id || transformId)
|
|
160
|
+
|
|
161
|
+
// build request object
|
|
162
|
+
const request = {
|
|
163
|
+
method,
|
|
164
|
+
path,
|
|
165
|
+
body: body || '',
|
|
166
|
+
querystring
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return this.transport.request(request, options, callback)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
TransformApi.prototype.startTransform = function transformStartTransformApi (params, options, callback) {
|
|
173
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
174
|
+
|
|
175
|
+
// check required parameters
|
|
176
|
+
if (params.transform_id == null && params.transformId == null) {
|
|
177
|
+
const err = new this[kConfigurationError]('Missing required parameter: transform_id or transformId')
|
|
178
|
+
return handleError(err, callback)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let { method, body, transformId, transform_id, ...querystring } = params
|
|
182
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
183
|
+
|
|
184
|
+
let path = ''
|
|
185
|
+
if (method == null) method = 'POST'
|
|
186
|
+
path = '/' + '_transform' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_start'
|
|
187
|
+
|
|
188
|
+
// build request object
|
|
189
|
+
const request = {
|
|
190
|
+
method,
|
|
191
|
+
path,
|
|
192
|
+
body: body || '',
|
|
193
|
+
querystring
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return this.transport.request(request, options, callback)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
TransformApi.prototype.stopTransform = function transformStopTransformApi (params, options, callback) {
|
|
200
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
201
|
+
|
|
202
|
+
// check required parameters
|
|
203
|
+
if (params.transform_id == null && params.transformId == null) {
|
|
204
|
+
const err = new this[kConfigurationError]('Missing required parameter: transform_id or transformId')
|
|
205
|
+
return handleError(err, callback)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
let { method, body, transformId, transform_id, ...querystring } = params
|
|
209
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
210
|
+
|
|
211
|
+
let path = ''
|
|
212
|
+
if (method == null) method = 'POST'
|
|
213
|
+
path = '/' + '_transform' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_stop'
|
|
214
|
+
|
|
215
|
+
// build request object
|
|
216
|
+
const request = {
|
|
217
|
+
method,
|
|
218
|
+
path,
|
|
219
|
+
body: body || '',
|
|
220
|
+
querystring
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return this.transport.request(request, options, callback)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
TransformApi.prototype.updateTransform = function transformUpdateTransformApi (params, options, callback) {
|
|
227
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
228
|
+
|
|
229
|
+
// check required parameters
|
|
230
|
+
if (params.transform_id == null && params.transformId == null) {
|
|
231
|
+
const err = new this[kConfigurationError]('Missing required parameter: transform_id or transformId')
|
|
232
|
+
return handleError(err, callback)
|
|
233
|
+
}
|
|
234
|
+
if (params.body == null) {
|
|
235
|
+
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
236
|
+
return handleError(err, callback)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
let { method, body, transformId, transform_id, ...querystring } = params
|
|
240
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
241
|
+
|
|
242
|
+
let path = ''
|
|
243
|
+
if (method == null) method = 'POST'
|
|
244
|
+
path = '/' + '_transform' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_update'
|
|
245
|
+
|
|
246
|
+
// build request object
|
|
247
|
+
const request = {
|
|
248
|
+
method,
|
|
249
|
+
path,
|
|
250
|
+
body: body || '',
|
|
251
|
+
querystring
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return this.transport.request(request, options, callback)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
Object.defineProperties(TransformApi.prototype, {
|
|
258
|
+
delete_transform: { get () { return this.deleteTransform } },
|
|
259
|
+
get_transform: { get () { return this.getTransform } },
|
|
260
|
+
get_transform_stats: { get () { return this.getTransformStats } },
|
|
261
|
+
preview_transform: { get () { return this.previewTransform } },
|
|
262
|
+
put_transform: { get () { return this.putTransform } },
|
|
263
|
+
start_transform: { get () { return this.startTransform } },
|
|
264
|
+
stop_transform: { get () { return this.stopTransform } },
|
|
265
|
+
update_transform: { get () { return this.updateTransform } }
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
module.exports = TransformApi
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
3
|
+
* license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright
|
|
5
|
+
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
6
|
+
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
* not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict'
|
|
21
|
+
|
|
22
|
+
/* eslint camelcase: 0 */
|
|
23
|
+
/* eslint no-unused-vars: 0 */
|
|
24
|
+
|
|
25
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
+
const acceptedQuerystring = ['wait_for_active_shards', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'lang', 'refresh', 'retry_on_conflict', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', retryOnConflict: 'retry_on_conflict', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function updateApi (params, options, callback) {
|
|
30
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
31
|
+
|
|
32
|
+
// check required parameters
|
|
33
|
+
if (params.id == null) {
|
|
34
|
+
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
35
|
+
return handleError(err, callback)
|
|
36
|
+
}
|
|
37
|
+
if (params.index == null) {
|
|
38
|
+
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
39
|
+
return handleError(err, callback)
|
|
40
|
+
}
|
|
41
|
+
if (params.body == null) {
|
|
42
|
+
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
43
|
+
return handleError(err, callback)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let { method, body, id, index, type, ...querystring } = params
|
|
47
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
48
|
+
|
|
49
|
+
let path = ''
|
|
50
|
+
if ((index) != null && (type) != null && (id) != null) {
|
|
51
|
+
if (method == null) method = 'POST'
|
|
52
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_update'
|
|
53
|
+
} else {
|
|
54
|
+
if (method == null) method = 'POST'
|
|
55
|
+
path = '/' + encodeURIComponent(index) + '/' + '_update' + '/' + encodeURIComponent(id)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// build request object
|
|
59
|
+
const request = {
|
|
60
|
+
method,
|
|
61
|
+
path,
|
|
62
|
+
body: body || '',
|
|
63
|
+
querystring
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return this.transport.request(request, options, callback)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = updateApi
|