@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.
Files changed (103) hide show
  1. package/.dockerignore +5 -0
  2. package/LICENSE +202 -0
  3. package/README.md +232 -0
  4. package/api/api/async_search.js +141 -0
  5. package/api/api/autoscaling.js +147 -0
  6. package/api/api/bulk.js +70 -0
  7. package/api/api/cat.js +648 -0
  8. package/api/api/ccr.js +403 -0
  9. package/api/api/clear_scroll.js +55 -0
  10. package/api/api/close_point_in_time.js +50 -0
  11. package/api/api/cluster.js +420 -0
  12. package/api/api/count.js +64 -0
  13. package/api/api/create.js +69 -0
  14. package/api/api/dangling_indices.js +115 -0
  15. package/api/api/delete.js +65 -0
  16. package/api/api/delete_by_query.js +71 -0
  17. package/api/api/delete_by_query_rethrottle.js +60 -0
  18. package/api/api/delete_script.js +56 -0
  19. package/api/api/enrich.js +173 -0
  20. package/api/api/eql.js +150 -0
  21. package/api/api/exists.js +65 -0
  22. package/api/api/exists_source.js +74 -0
  23. package/api/api/explain.js +65 -0
  24. package/api/api/features.js +81 -0
  25. package/api/api/field_caps.js +55 -0
  26. package/api/api/fleet.js +65 -0
  27. package/api/api/get.js +65 -0
  28. package/api/api/get_script.js +56 -0
  29. package/api/api/get_script_context.js +50 -0
  30. package/api/api/get_script_languages.js +50 -0
  31. package/api/api/get_source.js +65 -0
  32. package/api/api/graph.js +72 -0
  33. package/api/api/ilm.js +317 -0
  34. package/api/api/index.js +71 -0
  35. package/api/api/indices.js +1753 -0
  36. package/api/api/info.js +50 -0
  37. package/api/api/ingest.js +200 -0
  38. package/api/api/license.js +188 -0
  39. package/api/api/logstash.js +125 -0
  40. package/api/api/mget.js +70 -0
  41. package/api/api/migration.js +60 -0
  42. package/api/api/ml.js +2010 -0
  43. package/api/api/monitoring.js +66 -0
  44. package/api/api/msearch.js +70 -0
  45. package/api/api/msearch_template.js +70 -0
  46. package/api/api/mtermvectors.js +64 -0
  47. package/api/api/nodes.js +268 -0
  48. package/api/api/open_point_in_time.js +56 -0
  49. package/api/api/ping.js +50 -0
  50. package/api/api/put_script.js +71 -0
  51. package/api/api/rank_eval.js +61 -0
  52. package/api/api/reindex.js +56 -0
  53. package/api/api/reindex_rethrottle.js +60 -0
  54. package/api/api/render_search_template.js +55 -0
  55. package/api/api/rollup.js +319 -0
  56. package/api/api/scripts_painless_execute.js +50 -0
  57. package/api/api/scroll.js +55 -0
  58. package/api/api/search.js +64 -0
  59. package/api/api/search_mvt.js +87 -0
  60. package/api/api/search_shards.js +55 -0
  61. package/api/api/search_template.js +70 -0
  62. package/api/api/searchable_snapshots.js +186 -0
  63. package/api/api/security.js +1261 -0
  64. package/api/api/shutdown.js +124 -0
  65. package/api/api/slm.js +256 -0
  66. package/api/api/snapshot.js +439 -0
  67. package/api/api/sql.js +203 -0
  68. package/api/api/ssl.js +55 -0
  69. package/api/api/tasks.js +108 -0
  70. package/api/api/terms_enum.js +56 -0
  71. package/api/api/termvectors.js +67 -0
  72. package/api/api/text_structure.js +65 -0
  73. package/api/api/transform.js +268 -0
  74. package/api/api/update.js +69 -0
  75. package/api/api/update_by_query.js +67 -0
  76. package/api/api/update_by_query_rethrottle.js +60 -0
  77. package/api/api/watcher.js +333 -0
  78. package/api/api/xpack.js +76 -0
  79. package/api/index.js +508 -0
  80. package/api/new.d.ts +1585 -0
  81. package/api/requestParams.d.ts +2920 -0
  82. package/api/types.d.ts +15420 -0
  83. package/api/utils.js +58 -0
  84. package/codecov.yml +14 -0
  85. package/index.d.ts +2991 -0
  86. package/index.js +349 -0
  87. package/index.mjs +29 -0
  88. package/lib/Connection.d.ts +99 -0
  89. package/lib/Connection.js +392 -0
  90. package/lib/Helpers.d.ts +124 -0
  91. package/lib/Helpers.js +770 -0
  92. package/lib/Serializer.d.ts +30 -0
  93. package/lib/Serializer.js +94 -0
  94. package/lib/Transport.d.ts +162 -0
  95. package/lib/Transport.js +689 -0
  96. package/lib/errors.d.ts +90 -0
  97. package/lib/errors.js +159 -0
  98. package/lib/pool/BaseConnectionPool.js +262 -0
  99. package/lib/pool/CloudConnectionPool.js +64 -0
  100. package/lib/pool/ConnectionPool.js +246 -0
  101. package/lib/pool/index.d.ts +220 -0
  102. package/lib/pool/index.js +30 -0
  103. package/package.json +106 -0
@@ -0,0 +1,420 @@
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 = ['include_yes_decisions', 'include_disk_info', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'timeout', 'master_timeout', 'wait_for_removal', 'local', 'flat_settings', 'include_defaults', 'expand_wildcards', 'level', 'wait_for_active_shards', 'wait_for_nodes', 'wait_for_events', 'wait_for_no_relocating_shards', 'wait_for_no_initializing_shards', 'wait_for_status', 'node_ids', 'node_names', 'create', 'dry_run', 'explain', 'retry_failed', 'metric', 'wait_for_metadata_version', 'wait_for_timeout', 'ignore_unavailable', 'allow_no_indices']
27
+ const snakeCase = { includeYesDecisions: 'include_yes_decisions', includeDiskInfo: 'include_disk_info', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', waitForRemoval: 'wait_for_removal', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', expandWildcards: 'expand_wildcards', waitForActiveShards: 'wait_for_active_shards', waitForNodes: 'wait_for_nodes', waitForEvents: 'wait_for_events', waitForNoRelocatingShards: 'wait_for_no_relocating_shards', waitForNoInitializingShards: 'wait_for_no_initializing_shards', waitForStatus: 'wait_for_status', nodeIds: 'node_ids', nodeNames: 'node_names', dryRun: 'dry_run', retryFailed: 'retry_failed', waitForMetadataVersion: 'wait_for_metadata_version', waitForTimeout: 'wait_for_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices' }
28
+
29
+ function ClusterApi (transport, ConfigurationError) {
30
+ this.transport = transport
31
+ this[kConfigurationError] = ConfigurationError
32
+ }
33
+
34
+ ClusterApi.prototype.allocationExplain = function clusterAllocationExplainApi (params, options, callback) {
35
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
36
+
37
+ let { method, body, ...querystring } = params
38
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
39
+
40
+ let path = ''
41
+ if (method == null) method = body == null ? 'GET' : 'POST'
42
+ path = '/' + '_cluster' + '/' + 'allocation' + '/' + 'explain'
43
+
44
+ // build request object
45
+ const request = {
46
+ method,
47
+ path,
48
+ body: body || '',
49
+ querystring
50
+ }
51
+
52
+ return this.transport.request(request, options, callback)
53
+ }
54
+
55
+ ClusterApi.prototype.deleteComponentTemplate = function clusterDeleteComponentTemplateApi (params, options, callback) {
56
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
57
+
58
+ // check required parameters
59
+ if (params.name == null) {
60
+ const err = new this[kConfigurationError]('Missing required parameter: name')
61
+ return handleError(err, callback)
62
+ }
63
+
64
+ let { method, body, name, ...querystring } = params
65
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
66
+
67
+ let path = ''
68
+ if (method == null) method = 'DELETE'
69
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name)
70
+
71
+ // build request object
72
+ const request = {
73
+ method,
74
+ path,
75
+ body: body || '',
76
+ querystring
77
+ }
78
+
79
+ return this.transport.request(request, options, callback)
80
+ }
81
+
82
+ ClusterApi.prototype.deleteVotingConfigExclusions = function clusterDeleteVotingConfigExclusionsApi (params, options, callback) {
83
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
84
+
85
+ let { method, body, ...querystring } = params
86
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
87
+
88
+ let path = ''
89
+ if (method == null) method = 'DELETE'
90
+ path = '/' + '_cluster' + '/' + 'voting_config_exclusions'
91
+
92
+ // build request object
93
+ const request = {
94
+ method,
95
+ path,
96
+ body: body || '',
97
+ querystring
98
+ }
99
+
100
+ return this.transport.request(request, options, callback)
101
+ }
102
+
103
+ ClusterApi.prototype.existsComponentTemplate = function clusterExistsComponentTemplateApi (params, options, callback) {
104
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
105
+
106
+ // check required parameters
107
+ if (params.name == null) {
108
+ const err = new this[kConfigurationError]('Missing required parameter: name')
109
+ return handleError(err, callback)
110
+ }
111
+
112
+ let { method, body, name, ...querystring } = params
113
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
114
+
115
+ let path = ''
116
+ if (method == null) method = 'HEAD'
117
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name)
118
+
119
+ // build request object
120
+ const request = {
121
+ method,
122
+ path,
123
+ body: null,
124
+ querystring
125
+ }
126
+
127
+ return this.transport.request(request, options, callback)
128
+ }
129
+
130
+ ClusterApi.prototype.getComponentTemplate = function clusterGetComponentTemplateApi (params, options, callback) {
131
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
132
+
133
+ let { method, body, name, ...querystring } = params
134
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
135
+
136
+ let path = ''
137
+ if ((name) != null) {
138
+ if (method == null) method = 'GET'
139
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name)
140
+ } else {
141
+ if (method == null) method = 'GET'
142
+ path = '/' + '_component_template'
143
+ }
144
+
145
+ // build request object
146
+ const request = {
147
+ method,
148
+ path,
149
+ body: null,
150
+ querystring
151
+ }
152
+
153
+ return this.transport.request(request, options, callback)
154
+ }
155
+
156
+ ClusterApi.prototype.getSettings = function clusterGetSettingsApi (params, options, callback) {
157
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
158
+
159
+ let { method, body, ...querystring } = params
160
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
161
+
162
+ let path = ''
163
+ if (method == null) method = 'GET'
164
+ path = '/' + '_cluster' + '/' + 'settings'
165
+
166
+ // build request object
167
+ const request = {
168
+ method,
169
+ path,
170
+ body: null,
171
+ querystring
172
+ }
173
+
174
+ return this.transport.request(request, options, callback)
175
+ }
176
+
177
+ ClusterApi.prototype.health = function clusterHealthApi (params, options, callback) {
178
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
179
+
180
+ let { method, body, index, ...querystring } = params
181
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
182
+
183
+ let path = ''
184
+ if ((index) != null) {
185
+ if (method == null) method = 'GET'
186
+ path = '/' + '_cluster' + '/' + 'health' + '/' + encodeURIComponent(index)
187
+ } else {
188
+ if (method == null) method = 'GET'
189
+ path = '/' + '_cluster' + '/' + 'health'
190
+ }
191
+
192
+ // build request object
193
+ const request = {
194
+ method,
195
+ path,
196
+ body: null,
197
+ querystring
198
+ }
199
+
200
+ return this.transport.request(request, options, callback)
201
+ }
202
+
203
+ ClusterApi.prototype.pendingTasks = function clusterPendingTasksApi (params, options, callback) {
204
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
205
+
206
+ let { method, body, ...querystring } = params
207
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
208
+
209
+ let path = ''
210
+ if (method == null) method = 'GET'
211
+ path = '/' + '_cluster' + '/' + 'pending_tasks'
212
+
213
+ // build request object
214
+ const request = {
215
+ method,
216
+ path,
217
+ body: null,
218
+ querystring
219
+ }
220
+
221
+ return this.transport.request(request, options, callback)
222
+ }
223
+
224
+ ClusterApi.prototype.postVotingConfigExclusions = function clusterPostVotingConfigExclusionsApi (params, options, callback) {
225
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
226
+
227
+ let { method, body, ...querystring } = params
228
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
229
+
230
+ let path = ''
231
+ if (method == null) method = 'POST'
232
+ path = '/' + '_cluster' + '/' + 'voting_config_exclusions'
233
+
234
+ // build request object
235
+ const request = {
236
+ method,
237
+ path,
238
+ body: body || '',
239
+ querystring
240
+ }
241
+
242
+ return this.transport.request(request, options, callback)
243
+ }
244
+
245
+ ClusterApi.prototype.putComponentTemplate = function clusterPutComponentTemplateApi (params, options, callback) {
246
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
247
+
248
+ // check required parameters
249
+ if (params.name == null) {
250
+ const err = new this[kConfigurationError]('Missing required parameter: name')
251
+ return handleError(err, callback)
252
+ }
253
+ if (params.body == null) {
254
+ const err = new this[kConfigurationError]('Missing required parameter: body')
255
+ return handleError(err, callback)
256
+ }
257
+
258
+ let { method, body, name, ...querystring } = params
259
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
260
+
261
+ let path = ''
262
+ if (method == null) method = 'PUT'
263
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name)
264
+
265
+ // build request object
266
+ const request = {
267
+ method,
268
+ path,
269
+ body: body || '',
270
+ querystring
271
+ }
272
+
273
+ return this.transport.request(request, options, callback)
274
+ }
275
+
276
+ ClusterApi.prototype.putSettings = function clusterPutSettingsApi (params, options, callback) {
277
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
278
+
279
+ // check required parameters
280
+ if (params.body == null) {
281
+ const err = new this[kConfigurationError]('Missing required parameter: body')
282
+ return handleError(err, callback)
283
+ }
284
+
285
+ let { method, body, ...querystring } = params
286
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
287
+
288
+ let path = ''
289
+ if (method == null) method = 'PUT'
290
+ path = '/' + '_cluster' + '/' + 'settings'
291
+
292
+ // build request object
293
+ const request = {
294
+ method,
295
+ path,
296
+ body: body || '',
297
+ querystring
298
+ }
299
+
300
+ return this.transport.request(request, options, callback)
301
+ }
302
+
303
+ ClusterApi.prototype.remoteInfo = function clusterRemoteInfoApi (params, options, callback) {
304
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
305
+
306
+ let { method, body, ...querystring } = params
307
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
308
+
309
+ let path = ''
310
+ if (method == null) method = 'GET'
311
+ path = '/' + '_remote' + '/' + 'info'
312
+
313
+ // build request object
314
+ const request = {
315
+ method,
316
+ path,
317
+ body: null,
318
+ querystring
319
+ }
320
+
321
+ return this.transport.request(request, options, callback)
322
+ }
323
+
324
+ ClusterApi.prototype.reroute = function clusterRerouteApi (params, options, callback) {
325
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
326
+
327
+ let { method, body, ...querystring } = params
328
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
329
+
330
+ let path = ''
331
+ if (method == null) method = 'POST'
332
+ path = '/' + '_cluster' + '/' + 'reroute'
333
+
334
+ // build request object
335
+ const request = {
336
+ method,
337
+ path,
338
+ body: body || '',
339
+ querystring
340
+ }
341
+
342
+ return this.transport.request(request, options, callback)
343
+ }
344
+
345
+ ClusterApi.prototype.state = function clusterStateApi (params, options, callback) {
346
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
347
+
348
+ // check required url components
349
+ if (params.index != null && (params.metric == null)) {
350
+ const err = new this[kConfigurationError]('Missing required parameter of the url: metric')
351
+ return handleError(err, callback)
352
+ }
353
+
354
+ let { method, body, metric, index, ...querystring } = params
355
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
356
+
357
+ let path = ''
358
+ if ((metric) != null && (index) != null) {
359
+ if (method == null) method = 'GET'
360
+ path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index)
361
+ } else if ((metric) != null) {
362
+ if (method == null) method = 'GET'
363
+ path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric)
364
+ } else {
365
+ if (method == null) method = 'GET'
366
+ path = '/' + '_cluster' + '/' + 'state'
367
+ }
368
+
369
+ // build request object
370
+ const request = {
371
+ method,
372
+ path,
373
+ body: null,
374
+ querystring
375
+ }
376
+
377
+ return this.transport.request(request, options, callback)
378
+ }
379
+
380
+ ClusterApi.prototype.stats = function clusterStatsApi (params, options, callback) {
381
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
382
+
383
+ let { method, body, nodeId, node_id, ...querystring } = params
384
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
385
+
386
+ let path = ''
387
+ if ((node_id || nodeId) != null) {
388
+ if (method == null) method = 'GET'
389
+ path = '/' + '_cluster' + '/' + 'stats' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId)
390
+ } else {
391
+ if (method == null) method = 'GET'
392
+ path = '/' + '_cluster' + '/' + 'stats'
393
+ }
394
+
395
+ // build request object
396
+ const request = {
397
+ method,
398
+ path,
399
+ body: null,
400
+ querystring
401
+ }
402
+
403
+ return this.transport.request(request, options, callback)
404
+ }
405
+
406
+ Object.defineProperties(ClusterApi.prototype, {
407
+ allocation_explain: { get () { return this.allocationExplain } },
408
+ delete_component_template: { get () { return this.deleteComponentTemplate } },
409
+ delete_voting_config_exclusions: { get () { return this.deleteVotingConfigExclusions } },
410
+ exists_component_template: { get () { return this.existsComponentTemplate } },
411
+ get_component_template: { get () { return this.getComponentTemplate } },
412
+ get_settings: { get () { return this.getSettings } },
413
+ pending_tasks: { get () { return this.pendingTasks } },
414
+ post_voting_config_exclusions: { get () { return this.postVotingConfigExclusions } },
415
+ put_component_template: { get () { return this.putComponentTemplate } },
416
+ put_settings: { get () { return this.putSettings } },
417
+ remote_info: { get () { return this.remoteInfo } }
418
+ })
419
+
420
+ module.exports = ClusterApi
@@ -0,0 +1,64 @@
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 = ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'min_score', 'preference', 'routing', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'terminate_after', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { ignoreUnavailable: 'ignore_unavailable', ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', minScore: 'min_score', analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', terminateAfter: 'terminate_after', errorTrace: 'error_trace', filterPath: 'filter_path' }
28
+
29
+ function countApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
31
+
32
+ // check required url components
33
+ if (params.type != null && (params.index == null)) {
34
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
35
+ return handleError(err, callback)
36
+ }
37
+
38
+ let { method, body, index, type, ...querystring } = params
39
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
40
+
41
+ let path = ''
42
+ if ((index) != null && (type) != null) {
43
+ if (method == null) method = body == null ? 'GET' : 'POST'
44
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count'
45
+ } else if ((index) != null) {
46
+ if (method == null) method = body == null ? 'GET' : 'POST'
47
+ path = '/' + encodeURIComponent(index) + '/' + '_count'
48
+ } else {
49
+ if (method == null) method = body == null ? 'GET' : 'POST'
50
+ path = '/' + '_count'
51
+ }
52
+
53
+ // build request object
54
+ const request = {
55
+ method,
56
+ path,
57
+ body: body || '',
58
+ querystring
59
+ }
60
+
61
+ return this.transport.request(request, options, callback)
62
+ }
63
+
64
+ module.exports = countApi
@@ -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', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'pipeline', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { waitForActiveShards: 'wait_for_active_shards', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
28
+
29
+ function createApi (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 = 'PUT'
52
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create'
53
+ } else {
54
+ if (method == null) method = 'PUT'
55
+ path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + 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 = createApi
@@ -0,0 +1,115 @@
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 = ['accept_data_loss', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { acceptDataLoss: 'accept_data_loss', masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' }
28
+
29
+ function DanglingIndicesApi (transport, ConfigurationError) {
30
+ this.transport = transport
31
+ this[kConfigurationError] = ConfigurationError
32
+ }
33
+
34
+ DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDeleteDanglingIndexApi (params, options, callback) {
35
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
36
+
37
+ // check required parameters
38
+ if (params.index_uuid == null && params.indexUuid == null) {
39
+ const err = new this[kConfigurationError]('Missing required parameter: index_uuid or indexUuid')
40
+ return handleError(err, callback)
41
+ }
42
+
43
+ let { method, body, indexUuid, index_uuid, ...querystring } = params
44
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
45
+
46
+ let path = ''
47
+ if (method == null) method = 'DELETE'
48
+ path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid)
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
+ DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImportDanglingIndexApi (params, options, callback) {
62
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
63
+
64
+ // check required parameters
65
+ if (params.index_uuid == null && params.indexUuid == null) {
66
+ const err = new this[kConfigurationError]('Missing required parameter: index_uuid or indexUuid')
67
+ return handleError(err, callback)
68
+ }
69
+
70
+ let { method, body, indexUuid, index_uuid, ...querystring } = params
71
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
72
+
73
+ let path = ''
74
+ if (method == null) method = 'POST'
75
+ path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid)
76
+
77
+ // build request object
78
+ const request = {
79
+ method,
80
+ path,
81
+ body: body || '',
82
+ querystring
83
+ }
84
+
85
+ return this.transport.request(request, options, callback)
86
+ }
87
+
88
+ DanglingIndicesApi.prototype.listDanglingIndices = function danglingIndicesListDanglingIndicesApi (params, options, callback) {
89
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
90
+
91
+ let { method, body, ...querystring } = params
92
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
93
+
94
+ let path = ''
95
+ if (method == null) method = 'GET'
96
+ path = '/' + '_dangling'
97
+
98
+ // build request object
99
+ const request = {
100
+ method,
101
+ path,
102
+ body: null,
103
+ querystring
104
+ }
105
+
106
+ return this.transport.request(request, options, callback)
107
+ }
108
+
109
+ Object.defineProperties(DanglingIndicesApi.prototype, {
110
+ delete_dangling_index: { get () { return this.deleteDanglingIndex } },
111
+ import_dangling_index: { get () { return this.importDanglingIndex } },
112
+ list_dangling_indices: { get () { return this.listDanglingIndices } }
113
+ })
114
+
115
+ module.exports = DanglingIndicesApi