@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/graph.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
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 = ['routing', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function GraphApi (transport, ConfigurationError) {
|
|
30
|
+
this.transport = transport
|
|
31
|
+
this[kConfigurationError] = ConfigurationError
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
GraphApi.prototype.explore = function graphExploreApi (params, options, callback) {
|
|
35
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
36
|
+
|
|
37
|
+
// check required parameters
|
|
38
|
+
if (params.index == null) {
|
|
39
|
+
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
40
|
+
return handleError(err, callback)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// check required url components
|
|
44
|
+
if (params.type != null && (params.index == null)) {
|
|
45
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
|
46
|
+
return handleError(err, callback)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let { method, body, index, type, ...querystring } = params
|
|
50
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
51
|
+
|
|
52
|
+
let path = ''
|
|
53
|
+
if ((index) != null && (type) != null) {
|
|
54
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
55
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_graph' + '/' + 'explore'
|
|
56
|
+
} else {
|
|
57
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
58
|
+
path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore'
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// build request object
|
|
62
|
+
const request = {
|
|
63
|
+
method,
|
|
64
|
+
path,
|
|
65
|
+
body: body || '',
|
|
66
|
+
querystring
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return this.transport.request(request, options, callback)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
module.exports = GraphApi
|
package/api/api/ilm.js
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
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', 'only_managed', 'only_errors', 'dry_run']
|
|
27
|
+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', onlyManaged: 'only_managed', onlyErrors: 'only_errors', dryRun: 'dry_run' }
|
|
28
|
+
|
|
29
|
+
function IlmApi (transport, ConfigurationError) {
|
|
30
|
+
this.transport = transport
|
|
31
|
+
this[kConfigurationError] = ConfigurationError
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
IlmApi.prototype.deleteLifecycle = function ilmDeleteLifecycleApi (params, options, callback) {
|
|
35
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
36
|
+
|
|
37
|
+
// check required parameters
|
|
38
|
+
if (params.policy == null) {
|
|
39
|
+
const err = new this[kConfigurationError]('Missing required parameter: policy')
|
|
40
|
+
return handleError(err, callback)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let { method, body, policy, ...querystring } = params
|
|
44
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
45
|
+
|
|
46
|
+
let path = ''
|
|
47
|
+
if (method == null) method = 'DELETE'
|
|
48
|
+
path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(policy)
|
|
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
|
+
IlmApi.prototype.explainLifecycle = function ilmExplainLifecycleApi (params, options, callback) {
|
|
62
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
63
|
+
|
|
64
|
+
// check required parameters
|
|
65
|
+
if (params.index == null) {
|
|
66
|
+
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
67
|
+
return handleError(err, callback)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
let { method, body, index, ...querystring } = params
|
|
71
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
72
|
+
|
|
73
|
+
let path = ''
|
|
74
|
+
if (method == null) method = 'GET'
|
|
75
|
+
path = '/' + encodeURIComponent(index) + '/' + '_ilm' + '/' + 'explain'
|
|
76
|
+
|
|
77
|
+
// build request object
|
|
78
|
+
const request = {
|
|
79
|
+
method,
|
|
80
|
+
path,
|
|
81
|
+
body: null,
|
|
82
|
+
querystring
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return this.transport.request(request, options, callback)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
IlmApi.prototype.getLifecycle = function ilmGetLifecycleApi (params, options, callback) {
|
|
89
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
90
|
+
|
|
91
|
+
let { method, body, policy, ...querystring } = params
|
|
92
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
93
|
+
|
|
94
|
+
let path = ''
|
|
95
|
+
if ((policy) != null) {
|
|
96
|
+
if (method == null) method = 'GET'
|
|
97
|
+
path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(policy)
|
|
98
|
+
} else {
|
|
99
|
+
if (method == null) method = 'GET'
|
|
100
|
+
path = '/' + '_ilm' + '/' + 'policy'
|
|
101
|
+
}
|
|
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
|
+
IlmApi.prototype.getStatus = function ilmGetStatusApi (params, options, callback) {
|
|
115
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
116
|
+
|
|
117
|
+
let { method, body, ...querystring } = params
|
|
118
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
119
|
+
|
|
120
|
+
let path = ''
|
|
121
|
+
if (method == null) method = 'GET'
|
|
122
|
+
path = '/' + '_ilm' + '/' + 'status'
|
|
123
|
+
|
|
124
|
+
// build request object
|
|
125
|
+
const request = {
|
|
126
|
+
method,
|
|
127
|
+
path,
|
|
128
|
+
body: null,
|
|
129
|
+
querystring
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return this.transport.request(request, options, callback)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
IlmApi.prototype.migrateToDataTiers = function ilmMigrateToDataTiersApi (params, options, callback) {
|
|
136
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
137
|
+
|
|
138
|
+
let { method, body, ...querystring } = params
|
|
139
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
140
|
+
|
|
141
|
+
let path = ''
|
|
142
|
+
if (method == null) method = 'POST'
|
|
143
|
+
path = '/' + '_ilm' + '/' + 'migrate_to_data_tiers'
|
|
144
|
+
|
|
145
|
+
// build request object
|
|
146
|
+
const request = {
|
|
147
|
+
method,
|
|
148
|
+
path,
|
|
149
|
+
body: body || '',
|
|
150
|
+
querystring
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return this.transport.request(request, options, callback)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
IlmApi.prototype.moveToStep = function ilmMoveToStepApi (params, options, callback) {
|
|
157
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
158
|
+
|
|
159
|
+
// check required parameters
|
|
160
|
+
if (params.index == null) {
|
|
161
|
+
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
162
|
+
return handleError(err, callback)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
let { method, body, index, ...querystring } = params
|
|
166
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
167
|
+
|
|
168
|
+
let path = ''
|
|
169
|
+
if (method == null) method = 'POST'
|
|
170
|
+
path = '/' + '_ilm' + '/' + 'move' + '/' + encodeURIComponent(index)
|
|
171
|
+
|
|
172
|
+
// build request object
|
|
173
|
+
const request = {
|
|
174
|
+
method,
|
|
175
|
+
path,
|
|
176
|
+
body: body || '',
|
|
177
|
+
querystring
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return this.transport.request(request, options, callback)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
IlmApi.prototype.putLifecycle = function ilmPutLifecycleApi (params, options, callback) {
|
|
184
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
185
|
+
|
|
186
|
+
// check required parameters
|
|
187
|
+
if (params.policy == null) {
|
|
188
|
+
const err = new this[kConfigurationError]('Missing required parameter: policy')
|
|
189
|
+
return handleError(err, callback)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
let { method, body, policy, ...querystring } = params
|
|
193
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
194
|
+
|
|
195
|
+
let path = ''
|
|
196
|
+
if (method == null) method = 'PUT'
|
|
197
|
+
path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(policy)
|
|
198
|
+
|
|
199
|
+
// build request object
|
|
200
|
+
const request = {
|
|
201
|
+
method,
|
|
202
|
+
path,
|
|
203
|
+
body: body || '',
|
|
204
|
+
querystring
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return this.transport.request(request, options, callback)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
IlmApi.prototype.removePolicy = function ilmRemovePolicyApi (params, options, callback) {
|
|
211
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
212
|
+
|
|
213
|
+
// check required parameters
|
|
214
|
+
if (params.index == null) {
|
|
215
|
+
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
216
|
+
return handleError(err, callback)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
let { method, body, index, ...querystring } = params
|
|
220
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
221
|
+
|
|
222
|
+
let path = ''
|
|
223
|
+
if (method == null) method = 'POST'
|
|
224
|
+
path = '/' + encodeURIComponent(index) + '/' + '_ilm' + '/' + 'remove'
|
|
225
|
+
|
|
226
|
+
// build request object
|
|
227
|
+
const request = {
|
|
228
|
+
method,
|
|
229
|
+
path,
|
|
230
|
+
body: body || '',
|
|
231
|
+
querystring
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return this.transport.request(request, options, callback)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
IlmApi.prototype.retry = function ilmRetryApi (params, options, callback) {
|
|
238
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
239
|
+
|
|
240
|
+
// check required parameters
|
|
241
|
+
if (params.index == null) {
|
|
242
|
+
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
243
|
+
return handleError(err, callback)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
let { method, body, index, ...querystring } = params
|
|
247
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
248
|
+
|
|
249
|
+
let path = ''
|
|
250
|
+
if (method == null) method = 'POST'
|
|
251
|
+
path = '/' + encodeURIComponent(index) + '/' + '_ilm' + '/' + 'retry'
|
|
252
|
+
|
|
253
|
+
// build request object
|
|
254
|
+
const request = {
|
|
255
|
+
method,
|
|
256
|
+
path,
|
|
257
|
+
body: body || '',
|
|
258
|
+
querystring
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return this.transport.request(request, options, callback)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
IlmApi.prototype.start = function ilmStartApi (params, options, callback) {
|
|
265
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
266
|
+
|
|
267
|
+
let { method, body, ...querystring } = params
|
|
268
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
269
|
+
|
|
270
|
+
let path = ''
|
|
271
|
+
if (method == null) method = 'POST'
|
|
272
|
+
path = '/' + '_ilm' + '/' + 'start'
|
|
273
|
+
|
|
274
|
+
// build request object
|
|
275
|
+
const request = {
|
|
276
|
+
method,
|
|
277
|
+
path,
|
|
278
|
+
body: body || '',
|
|
279
|
+
querystring
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return this.transport.request(request, options, callback)
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
IlmApi.prototype.stop = function ilmStopApi (params, options, callback) {
|
|
286
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
287
|
+
|
|
288
|
+
let { method, body, ...querystring } = params
|
|
289
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
290
|
+
|
|
291
|
+
let path = ''
|
|
292
|
+
if (method == null) method = 'POST'
|
|
293
|
+
path = '/' + '_ilm' + '/' + 'stop'
|
|
294
|
+
|
|
295
|
+
// build request object
|
|
296
|
+
const request = {
|
|
297
|
+
method,
|
|
298
|
+
path,
|
|
299
|
+
body: body || '',
|
|
300
|
+
querystring
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return this.transport.request(request, options, callback)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
Object.defineProperties(IlmApi.prototype, {
|
|
307
|
+
delete_lifecycle: { get () { return this.deleteLifecycle } },
|
|
308
|
+
explain_lifecycle: { get () { return this.explainLifecycle } },
|
|
309
|
+
get_lifecycle: { get () { return this.getLifecycle } },
|
|
310
|
+
get_status: { get () { return this.getStatus } },
|
|
311
|
+
migrate_to_data_tiers: { get () { return this.migrateToDataTiers } },
|
|
312
|
+
move_to_step: { get () { return this.moveToStep } },
|
|
313
|
+
put_lifecycle: { get () { return this.putLifecycle } },
|
|
314
|
+
remove_policy: { get () { return this.removePolicy } }
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
module.exports = IlmApi
|
package/api/api/index.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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', 'op_type', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'if_seq_no', 'if_primary_term', 'pipeline', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { waitForActiveShards: 'wait_for_active_shards', opType: 'op_type', versionType: 'version_type', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function indexApi (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
|
+
if (params.body == null) {
|
|
38
|
+
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
39
|
+
return handleError(err, callback)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let { method, body, id, index, type, ...querystring } = params
|
|
43
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
44
|
+
|
|
45
|
+
let path = ''
|
|
46
|
+
if ((index) != null && (type) != null && (id) != null) {
|
|
47
|
+
if (method == null) method = 'PUT'
|
|
48
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
|
|
49
|
+
} else if ((index) != null && (id) != null) {
|
|
50
|
+
if (method == null) method = 'PUT'
|
|
51
|
+
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
|
|
52
|
+
} else if ((index) != null && (type) != null) {
|
|
53
|
+
if (method == null) method = 'POST'
|
|
54
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type)
|
|
55
|
+
} else {
|
|
56
|
+
if (method == null) method = 'POST'
|
|
57
|
+
path = '/' + encodeURIComponent(index) + '/' + '_doc'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// build request object
|
|
61
|
+
const request = {
|
|
62
|
+
method,
|
|
63
|
+
path,
|
|
64
|
+
body: body || '',
|
|
65
|
+
querystring
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return this.transport.request(request, options, callback)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
module.exports = indexApi
|