@opensearch-project/opensearch 1.0.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 (84) hide show
  1. package/.dockerignore +5 -0
  2. package/ADMINS.md +34 -0
  3. package/DEVELOPER_GUIDE.md +60 -0
  4. package/LICENSE.txt +201 -0
  5. package/MAINTAINERS.md +73 -0
  6. package/Makefile +27 -0
  7. package/NOTICE.txt +8 -0
  8. package/README.md +183 -0
  9. package/RELEASING.md +34 -0
  10. package/SECURITY.md +3 -0
  11. package/api/api/bulk.js +81 -0
  12. package/api/api/cat.js +525 -0
  13. package/api/api/clear_scroll.js +66 -0
  14. package/api/api/cluster.js +431 -0
  15. package/api/api/count.js +75 -0
  16. package/api/api/create.js +80 -0
  17. package/api/api/dangling_indices.js +126 -0
  18. package/api/api/delete.js +76 -0
  19. package/api/api/delete_by_query.js +82 -0
  20. package/api/api/delete_by_query_rethrottle.js +71 -0
  21. package/api/api/delete_script.js +67 -0
  22. package/api/api/exists.js +76 -0
  23. package/api/api/exists_source.js +85 -0
  24. package/api/api/explain.js +76 -0
  25. package/api/api/features.js +92 -0
  26. package/api/api/field_caps.js +66 -0
  27. package/api/api/get.js +76 -0
  28. package/api/api/get_script.js +67 -0
  29. package/api/api/get_script_context.js +61 -0
  30. package/api/api/get_script_languages.js +61 -0
  31. package/api/api/get_source.js +76 -0
  32. package/api/api/index.js +82 -0
  33. package/api/api/indices.js +1516 -0
  34. package/api/api/info.js +61 -0
  35. package/api/api/ingest.js +211 -0
  36. package/api/api/mget.js +81 -0
  37. package/api/api/msearch.js +81 -0
  38. package/api/api/msearch_template.js +81 -0
  39. package/api/api/mtermvectors.js +75 -0
  40. package/api/api/nodes.js +279 -0
  41. package/api/api/ping.js +61 -0
  42. package/api/api/put_script.js +82 -0
  43. package/api/api/rank_eval.js +72 -0
  44. package/api/api/reindex.js +67 -0
  45. package/api/api/reindex_rethrottle.js +71 -0
  46. package/api/api/render_search_template.js +66 -0
  47. package/api/api/scripts_painless_execute.js +61 -0
  48. package/api/api/scroll.js +66 -0
  49. package/api/api/search.js +75 -0
  50. package/api/api/search_shards.js +66 -0
  51. package/api/api/search_template.js +81 -0
  52. package/api/api/shutdown.js +135 -0
  53. package/api/api/snapshot.js +450 -0
  54. package/api/api/tasks.js +119 -0
  55. package/api/api/terms_enum.js +67 -0
  56. package/api/api/termvectors.js +78 -0
  57. package/api/api/update.js +80 -0
  58. package/api/api/update_by_query.js +78 -0
  59. package/api/api/update_by_query_rethrottle.js +71 -0
  60. package/api/index.js +254 -0
  61. package/api/new.d.ts +716 -0
  62. package/api/requestParams.d.ts +1583 -0
  63. package/api/types.d.ts +9481 -0
  64. package/api/utils.js +69 -0
  65. package/codecov.yml +14 -0
  66. package/index.d.ts +1210 -0
  67. package/index.js +338 -0
  68. package/index.mjs +40 -0
  69. package/lib/Connection.d.ts +107 -0
  70. package/lib/Connection.js +345 -0
  71. package/lib/Helpers.d.ts +135 -0
  72. package/lib/Helpers.js +779 -0
  73. package/lib/Serializer.d.ts +41 -0
  74. package/lib/Serializer.js +105 -0
  75. package/lib/Transport.d.ts +173 -0
  76. package/lib/Transport.js +646 -0
  77. package/lib/errors.d.ts +101 -0
  78. package/lib/errors.js +168 -0
  79. package/lib/pool/BaseConnectionPool.js +269 -0
  80. package/lib/pool/CloudConnectionPool.js +75 -0
  81. package/lib/pool/ConnectionPool.js +257 -0
  82. package/lib/pool/index.d.ts +215 -0
  83. package/lib/pool/index.js +41 -0
  84. package/package.json +102 -0
@@ -0,0 +1,1516 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'index', 'fielddata', 'fields', 'query', 'request', 'wait_for_active_shards', 'include_type_name', 'run_expensive_tasks', 'flush', 'local', 'flat_settings', 'include_defaults', 'force', 'wait_if_ongoing', 'max_num_segments', 'only_expunge_deletes', 'create', 'cause', 'write_index_only', 'preserve_existing', 'order', 'detailed', 'active_only', 'dry_run', 'verbose', 'status', 'copy_settings', 'completion_fields', 'fielddata_fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments', 'forbid_closed_indices', 'wait_for_completion', 'only_ancient_segments', 'explain', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'rewrite', 'all_shards']
38
+ const snakeCase = { masterTimeout: 'master_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', waitForActiveShards: 'wait_for_active_shards', includeTypeName: 'include_type_name', runExpensiveTasks: 'run_expensive_tasks', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', waitIfOngoing: 'wait_if_ongoing', maxNumSegments: 'max_num_segments', onlyExpungeDeletes: 'only_expunge_deletes', writeIndexOnly: 'write_index_only', preserveExisting: 'preserve_existing', activeOnly: 'active_only', dryRun: 'dry_run', copySettings: 'copy_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments', forbidClosedIndices: 'forbid_closed_indices', waitForCompletion: 'wait_for_completion', onlyAncientSegments: 'only_ancient_segments', analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', allShards: 'all_shards' }
39
+
40
+ function IndicesApi (transport, ConfigurationError) {
41
+ this.transport = transport
42
+ this[kConfigurationError] = ConfigurationError
43
+ }
44
+
45
+ IndicesApi.prototype.addBlock = function indicesAddBlockApi (params, options, callback) {
46
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
47
+
48
+ // check required parameters
49
+ if (params.index == null) {
50
+ const err = new this[kConfigurationError]('Missing required parameter: index')
51
+ return handleError(err, callback)
52
+ }
53
+ if (params.block == null) {
54
+ const err = new this[kConfigurationError]('Missing required parameter: block')
55
+ return handleError(err, callback)
56
+ }
57
+
58
+ // check required url components
59
+ if (params.block != null && (params.index == null)) {
60
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
61
+ return handleError(err, callback)
62
+ }
63
+
64
+ let { method, body, index, block, ...querystring } = params
65
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
66
+
67
+ let path = ''
68
+ if (method == null) method = 'PUT'
69
+ path = '/' + encodeURIComponent(index) + '/' + '_block' + '/' + encodeURIComponent(block)
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
+ IndicesApi.prototype.analyze = function indicesAnalyzeApi (params, options, callback) {
83
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
84
+
85
+ let { method, body, index, ...querystring } = params
86
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
87
+
88
+ let path = ''
89
+ if ((index) != null) {
90
+ if (method == null) method = body == null ? 'GET' : 'POST'
91
+ path = '/' + encodeURIComponent(index) + '/' + '_analyze'
92
+ } else {
93
+ if (method == null) method = body == null ? 'GET' : 'POST'
94
+ path = '/' + '_analyze'
95
+ }
96
+
97
+ // build request object
98
+ const request = {
99
+ method,
100
+ path,
101
+ body: body || '',
102
+ querystring
103
+ }
104
+
105
+ return this.transport.request(request, options, callback)
106
+ }
107
+
108
+ IndicesApi.prototype.clearCache = function indicesClearCacheApi (params, options, callback) {
109
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
110
+
111
+ let { method, body, index, ...querystring } = params
112
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
113
+
114
+ let path = ''
115
+ if ((index) != null) {
116
+ if (method == null) method = 'POST'
117
+ path = '/' + encodeURIComponent(index) + '/' + '_cache' + '/' + 'clear'
118
+ } else {
119
+ if (method == null) method = 'POST'
120
+ path = '/' + '_cache' + '/' + 'clear'
121
+ }
122
+
123
+ // build request object
124
+ const request = {
125
+ method,
126
+ path,
127
+ body: body || '',
128
+ querystring
129
+ }
130
+
131
+ return this.transport.request(request, options, callback)
132
+ }
133
+
134
+ IndicesApi.prototype.clone = function indicesCloneApi (params, options, callback) {
135
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
136
+
137
+ // check required parameters
138
+ if (params.index == null) {
139
+ const err = new this[kConfigurationError]('Missing required parameter: index')
140
+ return handleError(err, callback)
141
+ }
142
+ if (params.target == null) {
143
+ const err = new this[kConfigurationError]('Missing required parameter: target')
144
+ return handleError(err, callback)
145
+ }
146
+
147
+ // check required url components
148
+ if (params.target != null && (params.index == null)) {
149
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
150
+ return handleError(err, callback)
151
+ }
152
+
153
+ let { method, body, index, target, ...querystring } = params
154
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
155
+
156
+ let path = ''
157
+ if (method == null) method = 'PUT'
158
+ path = '/' + encodeURIComponent(index) + '/' + '_clone' + '/' + encodeURIComponent(target)
159
+
160
+ // build request object
161
+ const request = {
162
+ method,
163
+ path,
164
+ body: body || '',
165
+ querystring
166
+ }
167
+
168
+ return this.transport.request(request, options, callback)
169
+ }
170
+
171
+ IndicesApi.prototype.close = function indicesCloseApi (params, options, callback) {
172
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
173
+
174
+ // check required parameters
175
+ if (params.index == null) {
176
+ const err = new this[kConfigurationError]('Missing required parameter: index')
177
+ return handleError(err, callback)
178
+ }
179
+
180
+ let { method, body, index, ...querystring } = params
181
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
182
+
183
+ let path = ''
184
+ if (method == null) method = 'POST'
185
+ path = '/' + encodeURIComponent(index) + '/' + '_close'
186
+
187
+ // build request object
188
+ const request = {
189
+ method,
190
+ path,
191
+ body: body || '',
192
+ querystring
193
+ }
194
+
195
+ return this.transport.request(request, options, callback)
196
+ }
197
+
198
+ IndicesApi.prototype.create = function indicesCreateApi (params, options, callback) {
199
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
200
+
201
+ // check required parameters
202
+ if (params.index == null) {
203
+ const err = new this[kConfigurationError]('Missing required parameter: index')
204
+ return handleError(err, callback)
205
+ }
206
+
207
+ let { method, body, index, ...querystring } = params
208
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
209
+
210
+ let path = ''
211
+ if (method == null) method = 'PUT'
212
+ path = '/' + encodeURIComponent(index)
213
+
214
+ // build request object
215
+ const request = {
216
+ method,
217
+ path,
218
+ body: body || '',
219
+ querystring
220
+ }
221
+
222
+ return this.transport.request(request, options, callback)
223
+ }
224
+
225
+ IndicesApi.prototype.delete = function indicesDeleteApi (params, options, callback) {
226
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
227
+
228
+ // check required parameters
229
+ if (params.index == null) {
230
+ const err = new this[kConfigurationError]('Missing required parameter: index')
231
+ return handleError(err, callback)
232
+ }
233
+
234
+ let { method, body, index, ...querystring } = params
235
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
236
+
237
+ let path = ''
238
+ if (method == null) method = 'DELETE'
239
+ path = '/' + encodeURIComponent(index)
240
+
241
+ // build request object
242
+ const request = {
243
+ method,
244
+ path,
245
+ body: body || '',
246
+ querystring
247
+ }
248
+
249
+ return this.transport.request(request, options, callback)
250
+ }
251
+
252
+ IndicesApi.prototype.deleteAlias = function indicesDeleteAliasApi (params, options, callback) {
253
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
254
+
255
+ // check required parameters
256
+ if (params.index == null) {
257
+ const err = new this[kConfigurationError]('Missing required parameter: index')
258
+ return handleError(err, callback)
259
+ }
260
+ if (params.name == null) {
261
+ const err = new this[kConfigurationError]('Missing required parameter: name')
262
+ return handleError(err, callback)
263
+ }
264
+
265
+ // check required url components
266
+ if (params.name != null && (params.index == null)) {
267
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
268
+ return handleError(err, callback)
269
+ }
270
+
271
+ let { method, body, index, name, ...querystring } = params
272
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
273
+
274
+ let path = ''
275
+ if ((index) != null && (name) != null) {
276
+ if (method == null) method = 'DELETE'
277
+ path = '/' + encodeURIComponent(index) + '/' + '_alias' + '/' + encodeURIComponent(name)
278
+ } else {
279
+ if (method == null) method = 'DELETE'
280
+ path = '/' + encodeURIComponent(index) + '/' + '_aliases' + '/' + encodeURIComponent(name)
281
+ }
282
+
283
+ // build request object
284
+ const request = {
285
+ method,
286
+ path,
287
+ body: body || '',
288
+ querystring
289
+ }
290
+
291
+ return this.transport.request(request, options, callback)
292
+ }
293
+
294
+ IndicesApi.prototype.deleteIndexTemplate = function indicesDeleteIndexTemplateApi (params, options, callback) {
295
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
296
+
297
+ // check required parameters
298
+ if (params.name == null) {
299
+ const err = new this[kConfigurationError]('Missing required parameter: name')
300
+ return handleError(err, callback)
301
+ }
302
+
303
+ let { method, body, name, ...querystring } = params
304
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
305
+
306
+ let path = ''
307
+ if (method == null) method = 'DELETE'
308
+ path = '/' + '_index_template' + '/' + encodeURIComponent(name)
309
+
310
+ // build request object
311
+ const request = {
312
+ method,
313
+ path,
314
+ body: body || '',
315
+ querystring
316
+ }
317
+
318
+ return this.transport.request(request, options, callback)
319
+ }
320
+
321
+ IndicesApi.prototype.deleteTemplate = function indicesDeleteTemplateApi (params, options, callback) {
322
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
323
+
324
+ // check required parameters
325
+ if (params.name == null) {
326
+ const err = new this[kConfigurationError]('Missing required parameter: name')
327
+ return handleError(err, callback)
328
+ }
329
+
330
+ let { method, body, name, ...querystring } = params
331
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
332
+
333
+ let path = ''
334
+ if (method == null) method = 'DELETE'
335
+ path = '/' + '_template' + '/' + encodeURIComponent(name)
336
+
337
+ // build request object
338
+ const request = {
339
+ method,
340
+ path,
341
+ body: body || '',
342
+ querystring
343
+ }
344
+
345
+ return this.transport.request(request, options, callback)
346
+ }
347
+
348
+ IndicesApi.prototype.diskUsage = function indicesDiskUsageApi (params, options, callback) {
349
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
350
+
351
+ // check required parameters
352
+ if (params.index == null) {
353
+ const err = new this[kConfigurationError]('Missing required parameter: index')
354
+ return handleError(err, callback)
355
+ }
356
+
357
+ let { method, body, index, ...querystring } = params
358
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
359
+
360
+ let path = ''
361
+ if (method == null) method = 'POST'
362
+ path = '/' + encodeURIComponent(index) + '/' + '_disk_usage'
363
+
364
+ // build request object
365
+ const request = {
366
+ method,
367
+ path,
368
+ body: body || '',
369
+ querystring
370
+ }
371
+
372
+ return this.transport.request(request, options, callback)
373
+ }
374
+
375
+ IndicesApi.prototype.exists = function indicesExistsApi (params, options, callback) {
376
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
377
+
378
+ // check required parameters
379
+ if (params.index == null) {
380
+ const err = new this[kConfigurationError]('Missing required parameter: index')
381
+ return handleError(err, callback)
382
+ }
383
+
384
+ let { method, body, index, ...querystring } = params
385
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
386
+
387
+ let path = ''
388
+ if (method == null) method = 'HEAD'
389
+ path = '/' + encodeURIComponent(index)
390
+
391
+ // build request object
392
+ const request = {
393
+ method,
394
+ path,
395
+ body: null,
396
+ querystring
397
+ }
398
+
399
+ return this.transport.request(request, options, callback)
400
+ }
401
+
402
+ IndicesApi.prototype.existsAlias = function indicesExistsAliasApi (params, options, callback) {
403
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
404
+
405
+ // check required parameters
406
+ if (params.name == null) {
407
+ const err = new this[kConfigurationError]('Missing required parameter: name')
408
+ return handleError(err, callback)
409
+ }
410
+
411
+ let { method, body, name, index, ...querystring } = params
412
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
413
+
414
+ let path = ''
415
+ if ((index) != null && (name) != null) {
416
+ if (method == null) method = 'HEAD'
417
+ path = '/' + encodeURIComponent(index) + '/' + '_alias' + '/' + encodeURIComponent(name)
418
+ } else {
419
+ if (method == null) method = 'HEAD'
420
+ path = '/' + '_alias' + '/' + encodeURIComponent(name)
421
+ }
422
+
423
+ // build request object
424
+ const request = {
425
+ method,
426
+ path,
427
+ body: null,
428
+ querystring
429
+ }
430
+
431
+ return this.transport.request(request, options, callback)
432
+ }
433
+
434
+ IndicesApi.prototype.existsIndexTemplate = function indicesExistsIndexTemplateApi (params, options, callback) {
435
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
436
+
437
+ // check required parameters
438
+ if (params.name == null) {
439
+ const err = new this[kConfigurationError]('Missing required parameter: name')
440
+ return handleError(err, callback)
441
+ }
442
+
443
+ let { method, body, name, ...querystring } = params
444
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
445
+
446
+ let path = ''
447
+ if (method == null) method = 'HEAD'
448
+ path = '/' + '_index_template' + '/' + encodeURIComponent(name)
449
+
450
+ // build request object
451
+ const request = {
452
+ method,
453
+ path,
454
+ body: null,
455
+ querystring
456
+ }
457
+
458
+ return this.transport.request(request, options, callback)
459
+ }
460
+
461
+ IndicesApi.prototype.existsTemplate = function indicesExistsTemplateApi (params, options, callback) {
462
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
463
+
464
+ // check required parameters
465
+ if (params.name == null) {
466
+ const err = new this[kConfigurationError]('Missing required parameter: name')
467
+ return handleError(err, callback)
468
+ }
469
+
470
+ let { method, body, name, ...querystring } = params
471
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
472
+
473
+ let path = ''
474
+ if (method == null) method = 'HEAD'
475
+ path = '/' + '_template' + '/' + encodeURIComponent(name)
476
+
477
+ // build request object
478
+ const request = {
479
+ method,
480
+ path,
481
+ body: null,
482
+ querystring
483
+ }
484
+
485
+ return this.transport.request(request, options, callback)
486
+ }
487
+
488
+ IndicesApi.prototype.existsType = function indicesExistsTypeApi (params, options, callback) {
489
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
490
+
491
+ // check required parameters
492
+ if (params.index == null) {
493
+ const err = new this[kConfigurationError]('Missing required parameter: index')
494
+ return handleError(err, callback)
495
+ }
496
+ if (params.type == null) {
497
+ const err = new this[kConfigurationError]('Missing required parameter: type')
498
+ return handleError(err, callback)
499
+ }
500
+
501
+ // check required url components
502
+ if (params.type != null && (params.index == null)) {
503
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
504
+ return handleError(err, callback)
505
+ }
506
+
507
+ let { method, body, index, type, ...querystring } = params
508
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
509
+
510
+ let path = ''
511
+ if (method == null) method = 'HEAD'
512
+ path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type)
513
+
514
+ // build request object
515
+ const request = {
516
+ method,
517
+ path,
518
+ body: null,
519
+ querystring
520
+ }
521
+
522
+ return this.transport.request(request, options, callback)
523
+ }
524
+
525
+ IndicesApi.prototype.fieldUsageStats = function indicesFieldUsageStatsApi (params, options, callback) {
526
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
527
+
528
+ // check required parameters
529
+ if (params.index == null) {
530
+ const err = new this[kConfigurationError]('Missing required parameter: index')
531
+ return handleError(err, callback)
532
+ }
533
+
534
+ let { method, body, index, ...querystring } = params
535
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
536
+
537
+ let path = ''
538
+ if (method == null) method = 'GET'
539
+ path = '/' + encodeURIComponent(index) + '/' + '_field_usage_stats'
540
+
541
+ // build request object
542
+ const request = {
543
+ method,
544
+ path,
545
+ body: null,
546
+ querystring
547
+ }
548
+
549
+ return this.transport.request(request, options, callback)
550
+ }
551
+
552
+ IndicesApi.prototype.flush = function indicesFlushApi (params, options, callback) {
553
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
554
+
555
+ let { method, body, index, ...querystring } = params
556
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
557
+
558
+ let path = ''
559
+ if ((index) != null) {
560
+ if (method == null) method = body == null ? 'GET' : 'POST'
561
+ path = '/' + encodeURIComponent(index) + '/' + '_flush'
562
+ } else {
563
+ if (method == null) method = body == null ? 'GET' : 'POST'
564
+ path = '/' + '_flush'
565
+ }
566
+
567
+ // build request object
568
+ const request = {
569
+ method,
570
+ path,
571
+ body: body || '',
572
+ querystring
573
+ }
574
+
575
+ return this.transport.request(request, options, callback)
576
+ }
577
+
578
+ IndicesApi.prototype.flushSynced = function indicesFlushSyncedApi (params, options, callback) {
579
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
580
+
581
+ let { method, body, index, ...querystring } = params
582
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
583
+
584
+ let path = ''
585
+ if (method == null) method = body == null ? 'GET' : 'POST'
586
+ path = '/' + encodeURIComponent(index) + '/' + '_flush' + '/' + 'synced'
587
+
588
+ // build request object
589
+ const request = {
590
+ method,
591
+ path,
592
+ body: body || '',
593
+ querystring
594
+ }
595
+
596
+ return this.transport.request(request, options, callback)
597
+ }
598
+
599
+ IndicesApi.prototype.forcemerge = function indicesForcemergeApi (params, options, callback) {
600
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
601
+
602
+ let { method, body, index, ...querystring } = params
603
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
604
+
605
+ let path = ''
606
+ if ((index) != null) {
607
+ if (method == null) method = 'POST'
608
+ path = '/' + encodeURIComponent(index) + '/' + '_forcemerge'
609
+ } else {
610
+ if (method == null) method = 'POST'
611
+ path = '/' + '_forcemerge'
612
+ }
613
+
614
+ // build request object
615
+ const request = {
616
+ method,
617
+ path,
618
+ body: body || '',
619
+ querystring
620
+ }
621
+
622
+ return this.transport.request(request, options, callback)
623
+ }
624
+
625
+ IndicesApi.prototype.get = function indicesGetApi (params, options, callback) {
626
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
627
+
628
+ // check required parameters
629
+ if (params.index == null) {
630
+ const err = new this[kConfigurationError]('Missing required parameter: index')
631
+ return handleError(err, callback)
632
+ }
633
+
634
+ let { method, body, index, ...querystring } = params
635
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
636
+
637
+ let path = ''
638
+ if (method == null) method = 'GET'
639
+ path = '/' + encodeURIComponent(index)
640
+
641
+ // build request object
642
+ const request = {
643
+ method,
644
+ path,
645
+ body: null,
646
+ querystring
647
+ }
648
+
649
+ return this.transport.request(request, options, callback)
650
+ }
651
+
652
+ IndicesApi.prototype.getAlias = function indicesGetAliasApi (params, options, callback) {
653
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
654
+
655
+ let { method, body, name, index, ...querystring } = params
656
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
657
+
658
+ let path = ''
659
+ if ((index) != null && (name) != null) {
660
+ if (method == null) method = 'GET'
661
+ path = '/' + encodeURIComponent(index) + '/' + '_alias' + '/' + encodeURIComponent(name)
662
+ } else if ((name) != null) {
663
+ if (method == null) method = 'GET'
664
+ path = '/' + '_alias' + '/' + encodeURIComponent(name)
665
+ } else if ((index) != null) {
666
+ if (method == null) method = 'GET'
667
+ path = '/' + encodeURIComponent(index) + '/' + '_alias'
668
+ } else {
669
+ if (method == null) method = 'GET'
670
+ path = '/' + '_alias'
671
+ }
672
+
673
+ // build request object
674
+ const request = {
675
+ method,
676
+ path,
677
+ body: null,
678
+ querystring
679
+ }
680
+
681
+ return this.transport.request(request, options, callback)
682
+ }
683
+
684
+ IndicesApi.prototype.getFieldMapping = function indicesGetFieldMappingApi (params, options, callback) {
685
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
686
+
687
+ // check required parameters
688
+ if (params.fields == null) {
689
+ const err = new this[kConfigurationError]('Missing required parameter: fields')
690
+ return handleError(err, callback)
691
+ }
692
+
693
+ let { method, body, fields, index, type, ...querystring } = params
694
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
695
+
696
+ let path = ''
697
+ if ((index) != null && (type) != null && (fields) != null) {
698
+ if (method == null) method = 'GET'
699
+ path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields)
700
+ } else if ((index) != null && (fields) != null) {
701
+ if (method == null) method = 'GET'
702
+ path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields)
703
+ } else if ((type) != null && (fields) != null) {
704
+ if (method == null) method = 'GET'
705
+ path = '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields)
706
+ } else {
707
+ if (method == null) method = 'GET'
708
+ path = '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields)
709
+ }
710
+
711
+ // build request object
712
+ const request = {
713
+ method,
714
+ path,
715
+ body: null,
716
+ querystring
717
+ }
718
+
719
+ return this.transport.request(request, options, callback)
720
+ }
721
+
722
+ IndicesApi.prototype.getIndexTemplate = function indicesGetIndexTemplateApi (params, options, callback) {
723
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
724
+
725
+ let { method, body, name, ...querystring } = params
726
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
727
+
728
+ let path = ''
729
+ if ((name) != null) {
730
+ if (method == null) method = 'GET'
731
+ path = '/' + '_index_template' + '/' + encodeURIComponent(name)
732
+ } else {
733
+ if (method == null) method = 'GET'
734
+ path = '/' + '_index_template'
735
+ }
736
+
737
+ // build request object
738
+ const request = {
739
+ method,
740
+ path,
741
+ body: null,
742
+ querystring
743
+ }
744
+
745
+ return this.transport.request(request, options, callback)
746
+ }
747
+
748
+ IndicesApi.prototype.getMapping = function indicesGetMappingApi (params, options, callback) {
749
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
750
+
751
+ let { method, body, index, type, ...querystring } = params
752
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
753
+
754
+ let path = ''
755
+ if ((index) != null && (type) != null) {
756
+ if (method == null) method = 'GET'
757
+ path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type)
758
+ } else if ((index) != null) {
759
+ if (method == null) method = 'GET'
760
+ path = '/' + encodeURIComponent(index) + '/' + '_mapping'
761
+ } else if ((type) != null) {
762
+ if (method == null) method = 'GET'
763
+ path = '/' + '_mapping' + '/' + encodeURIComponent(type)
764
+ } else {
765
+ if (method == null) method = 'GET'
766
+ path = '/' + '_mapping'
767
+ }
768
+
769
+ // build request object
770
+ const request = {
771
+ method,
772
+ path,
773
+ body: null,
774
+ querystring
775
+ }
776
+
777
+ return this.transport.request(request, options, callback)
778
+ }
779
+
780
+ IndicesApi.prototype.getSettings = function indicesGetSettingsApi (params, options, callback) {
781
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
782
+
783
+ let { method, body, index, name, ...querystring } = params
784
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
785
+
786
+ let path = ''
787
+ if ((index) != null && (name) != null) {
788
+ if (method == null) method = 'GET'
789
+ path = '/' + encodeURIComponent(index) + '/' + '_settings' + '/' + encodeURIComponent(name)
790
+ } else if ((index) != null) {
791
+ if (method == null) method = 'GET'
792
+ path = '/' + encodeURIComponent(index) + '/' + '_settings'
793
+ } else if ((name) != null) {
794
+ if (method == null) method = 'GET'
795
+ path = '/' + '_settings' + '/' + encodeURIComponent(name)
796
+ } else {
797
+ if (method == null) method = 'GET'
798
+ path = '/' + '_settings'
799
+ }
800
+
801
+ // build request object
802
+ const request = {
803
+ method,
804
+ path,
805
+ body: null,
806
+ querystring
807
+ }
808
+
809
+ return this.transport.request(request, options, callback)
810
+ }
811
+
812
+ IndicesApi.prototype.getTemplate = function indicesGetTemplateApi (params, options, callback) {
813
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
814
+
815
+ let { method, body, name, ...querystring } = params
816
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
817
+
818
+ let path = ''
819
+ if ((name) != null) {
820
+ if (method == null) method = 'GET'
821
+ path = '/' + '_template' + '/' + encodeURIComponent(name)
822
+ } else {
823
+ if (method == null) method = 'GET'
824
+ path = '/' + '_template'
825
+ }
826
+
827
+ // build request object
828
+ const request = {
829
+ method,
830
+ path,
831
+ body: null,
832
+ querystring
833
+ }
834
+
835
+ return this.transport.request(request, options, callback)
836
+ }
837
+
838
+ IndicesApi.prototype.getUpgrade = function indicesGetUpgradeApi (params, options, callback) {
839
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
840
+
841
+ let { method, body, index, ...querystring } = params
842
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
843
+
844
+ let path = ''
845
+ if (method == null) method = 'GET'
846
+ path = '/' + encodeURIComponent(index) + '/' + '_upgrade'
847
+
848
+ // build request object
849
+ const request = {
850
+ method,
851
+ path,
852
+ body: null,
853
+ querystring
854
+ }
855
+
856
+ return this.transport.request(request, options, callback)
857
+ }
858
+
859
+ IndicesApi.prototype.open = function indicesOpenApi (params, options, callback) {
860
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
861
+
862
+ // check required parameters
863
+ if (params.index == null) {
864
+ const err = new this[kConfigurationError]('Missing required parameter: index')
865
+ return handleError(err, callback)
866
+ }
867
+
868
+ let { method, body, index, ...querystring } = params
869
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
870
+
871
+ let path = ''
872
+ if (method == null) method = 'POST'
873
+ path = '/' + encodeURIComponent(index) + '/' + '_open'
874
+
875
+ // build request object
876
+ const request = {
877
+ method,
878
+ path,
879
+ body: body || '',
880
+ querystring
881
+ }
882
+
883
+ return this.transport.request(request, options, callback)
884
+ }
885
+
886
+ IndicesApi.prototype.putAlias = function indicesPutAliasApi (params, options, callback) {
887
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
888
+
889
+ // check required parameters
890
+ if (params.index == null) {
891
+ const err = new this[kConfigurationError]('Missing required parameter: index')
892
+ return handleError(err, callback)
893
+ }
894
+ if (params.name == null) {
895
+ const err = new this[kConfigurationError]('Missing required parameter: name')
896
+ return handleError(err, callback)
897
+ }
898
+
899
+ // check required url components
900
+ if (params.name != null && (params.index == null)) {
901
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
902
+ return handleError(err, callback)
903
+ }
904
+
905
+ let { method, body, index, name, ...querystring } = params
906
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
907
+
908
+ let path = ''
909
+ if ((index) != null && (name) != null) {
910
+ if (method == null) method = 'PUT'
911
+ path = '/' + encodeURIComponent(index) + '/' + '_alias' + '/' + encodeURIComponent(name)
912
+ } else {
913
+ if (method == null) method = 'PUT'
914
+ path = '/' + encodeURIComponent(index) + '/' + '_aliases' + '/' + encodeURIComponent(name)
915
+ }
916
+
917
+ // build request object
918
+ const request = {
919
+ method,
920
+ path,
921
+ body: body || '',
922
+ querystring
923
+ }
924
+
925
+ return this.transport.request(request, options, callback)
926
+ }
927
+
928
+ IndicesApi.prototype.putIndexTemplate = function indicesPutIndexTemplateApi (params, options, callback) {
929
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
930
+
931
+ // check required parameters
932
+ if (params.name == null) {
933
+ const err = new this[kConfigurationError]('Missing required parameter: name')
934
+ return handleError(err, callback)
935
+ }
936
+ if (params.body == null) {
937
+ const err = new this[kConfigurationError]('Missing required parameter: body')
938
+ return handleError(err, callback)
939
+ }
940
+
941
+ let { method, body, name, ...querystring } = params
942
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
943
+
944
+ let path = ''
945
+ if (method == null) method = 'PUT'
946
+ path = '/' + '_index_template' + '/' + encodeURIComponent(name)
947
+
948
+ // build request object
949
+ const request = {
950
+ method,
951
+ path,
952
+ body: body || '',
953
+ querystring
954
+ }
955
+
956
+ return this.transport.request(request, options, callback)
957
+ }
958
+
959
+ IndicesApi.prototype.putMapping = function indicesPutMappingApi (params, options, callback) {
960
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
961
+
962
+ // check required parameters
963
+ if (params.body == null) {
964
+ const err = new this[kConfigurationError]('Missing required parameter: body')
965
+ return handleError(err, callback)
966
+ }
967
+
968
+ let { method, body, index, type, ...querystring } = params
969
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
970
+
971
+ let path = ''
972
+ if ((index) != null && (type) != null) {
973
+ if (method == null) method = 'PUT'
974
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mapping'
975
+ } else if ((index) != null && (type) != null) {
976
+ if (method == null) method = 'PUT'
977
+ path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type)
978
+ } else if ((index) != null && (type) != null) {
979
+ if (method == null) method = 'PUT'
980
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mappings'
981
+ } else if ((index) != null && (type) != null) {
982
+ if (method == null) method = 'PUT'
983
+ path = '/' + encodeURIComponent(index) + '/' + '_mappings' + '/' + encodeURIComponent(type)
984
+ } else if ((index) != null) {
985
+ if (method == null) method = 'PUT'
986
+ path = '/' + encodeURIComponent(index) + '/' + '_mapping'
987
+ } else if ((type) != null) {
988
+ if (method == null) method = 'PUT'
989
+ path = '/' + '_mappings' + '/' + encodeURIComponent(type)
990
+ } else if ((index) != null) {
991
+ if (method == null) method = 'PUT'
992
+ path = '/' + encodeURIComponent(index) + '/' + '_mappings'
993
+ } else {
994
+ if (method == null) method = 'PUT'
995
+ path = '/' + '_mapping' + '/' + encodeURIComponent(type)
996
+ }
997
+
998
+ // build request object
999
+ const request = {
1000
+ method,
1001
+ path,
1002
+ body: body || '',
1003
+ querystring
1004
+ }
1005
+
1006
+ return this.transport.request(request, options, callback)
1007
+ }
1008
+
1009
+ IndicesApi.prototype.putSettings = function indicesPutSettingsApi (params, options, callback) {
1010
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1011
+
1012
+ // check required parameters
1013
+ if (params.body == null) {
1014
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1015
+ return handleError(err, callback)
1016
+ }
1017
+
1018
+ let { method, body, index, ...querystring } = params
1019
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1020
+
1021
+ let path = ''
1022
+ if ((index) != null) {
1023
+ if (method == null) method = 'PUT'
1024
+ path = '/' + encodeURIComponent(index) + '/' + '_settings'
1025
+ } else {
1026
+ if (method == null) method = 'PUT'
1027
+ path = '/' + '_settings'
1028
+ }
1029
+
1030
+ // build request object
1031
+ const request = {
1032
+ method,
1033
+ path,
1034
+ body: body || '',
1035
+ querystring
1036
+ }
1037
+
1038
+ return this.transport.request(request, options, callback)
1039
+ }
1040
+
1041
+ IndicesApi.prototype.putTemplate = function indicesPutTemplateApi (params, options, callback) {
1042
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1043
+
1044
+ // check required parameters
1045
+ if (params.name == null) {
1046
+ const err = new this[kConfigurationError]('Missing required parameter: name')
1047
+ return handleError(err, callback)
1048
+ }
1049
+ if (params.body == null) {
1050
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1051
+ return handleError(err, callback)
1052
+ }
1053
+
1054
+ let { method, body, name, ...querystring } = params
1055
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1056
+
1057
+ let path = ''
1058
+ if (method == null) method = 'PUT'
1059
+ path = '/' + '_template' + '/' + encodeURIComponent(name)
1060
+
1061
+ // build request object
1062
+ const request = {
1063
+ method,
1064
+ path,
1065
+ body: body || '',
1066
+ querystring
1067
+ }
1068
+
1069
+ return this.transport.request(request, options, callback)
1070
+ }
1071
+
1072
+ IndicesApi.prototype.recovery = function indicesRecoveryApi (params, options, callback) {
1073
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1074
+
1075
+ let { method, body, index, ...querystring } = params
1076
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1077
+
1078
+ let path = ''
1079
+ if ((index) != null) {
1080
+ if (method == null) method = 'GET'
1081
+ path = '/' + encodeURIComponent(index) + '/' + '_recovery'
1082
+ } else {
1083
+ if (method == null) method = 'GET'
1084
+ path = '/' + '_recovery'
1085
+ }
1086
+
1087
+ // build request object
1088
+ const request = {
1089
+ method,
1090
+ path,
1091
+ body: null,
1092
+ querystring
1093
+ }
1094
+
1095
+ return this.transport.request(request, options, callback)
1096
+ }
1097
+
1098
+ IndicesApi.prototype.refresh = function indicesRefreshApi (params, options, callback) {
1099
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1100
+
1101
+ let { method, body, index, ...querystring } = params
1102
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1103
+
1104
+ let path = ''
1105
+ if ((index) != null) {
1106
+ if (method == null) method = body == null ? 'GET' : 'POST'
1107
+ path = '/' + encodeURIComponent(index) + '/' + '_refresh'
1108
+ } else {
1109
+ if (method == null) method = body == null ? 'GET' : 'POST'
1110
+ path = '/' + '_refresh'
1111
+ }
1112
+
1113
+ // build request object
1114
+ const request = {
1115
+ method,
1116
+ path,
1117
+ body: body || '',
1118
+ querystring
1119
+ }
1120
+
1121
+ return this.transport.request(request, options, callback)
1122
+ }
1123
+
1124
+ IndicesApi.prototype.resolveIndex = function indicesResolveIndexApi (params, options, callback) {
1125
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1126
+
1127
+ // check required parameters
1128
+ if (params.name == null) {
1129
+ const err = new this[kConfigurationError]('Missing required parameter: name')
1130
+ return handleError(err, callback)
1131
+ }
1132
+
1133
+ let { method, body, name, ...querystring } = params
1134
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1135
+
1136
+ let path = ''
1137
+ if (method == null) method = 'GET'
1138
+ path = '/' + '_resolve' + '/' + 'index' + '/' + encodeURIComponent(name)
1139
+
1140
+ // build request object
1141
+ const request = {
1142
+ method,
1143
+ path,
1144
+ body: null,
1145
+ querystring
1146
+ }
1147
+
1148
+ return this.transport.request(request, options, callback)
1149
+ }
1150
+
1151
+ IndicesApi.prototype.rollover = function indicesRolloverApi (params, options, callback) {
1152
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1153
+
1154
+ // check required parameters
1155
+ if (params.alias == null) {
1156
+ const err = new this[kConfigurationError]('Missing required parameter: alias')
1157
+ return handleError(err, callback)
1158
+ }
1159
+
1160
+ // check required url components
1161
+ if ((params.new_index != null || params.newIndex != null) && (params.alias == null)) {
1162
+ const err = new this[kConfigurationError]('Missing required parameter of the url: alias')
1163
+ return handleError(err, callback)
1164
+ }
1165
+
1166
+ let { method, body, alias, newIndex, new_index, ...querystring } = params
1167
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1168
+
1169
+ let path = ''
1170
+ if ((alias) != null && (new_index || newIndex) != null) {
1171
+ if (method == null) method = 'POST'
1172
+ path = '/' + encodeURIComponent(alias) + '/' + '_rollover' + '/' + encodeURIComponent(new_index || newIndex)
1173
+ } else {
1174
+ if (method == null) method = 'POST'
1175
+ path = '/' + encodeURIComponent(alias) + '/' + '_rollover'
1176
+ }
1177
+
1178
+ // build request object
1179
+ const request = {
1180
+ method,
1181
+ path,
1182
+ body: body || '',
1183
+ querystring
1184
+ }
1185
+
1186
+ return this.transport.request(request, options, callback)
1187
+ }
1188
+
1189
+ IndicesApi.prototype.segments = function indicesSegmentsApi (params, options, callback) {
1190
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1191
+
1192
+ let { method, body, index, ...querystring } = params
1193
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1194
+
1195
+ let path = ''
1196
+ if ((index) != null) {
1197
+ if (method == null) method = 'GET'
1198
+ path = '/' + encodeURIComponent(index) + '/' + '_segments'
1199
+ } else {
1200
+ if (method == null) method = 'GET'
1201
+ path = '/' + '_segments'
1202
+ }
1203
+
1204
+ // build request object
1205
+ const request = {
1206
+ method,
1207
+ path,
1208
+ body: null,
1209
+ querystring
1210
+ }
1211
+
1212
+ return this.transport.request(request, options, callback)
1213
+ }
1214
+
1215
+ IndicesApi.prototype.shardStores = function indicesShardStoresApi (params, options, callback) {
1216
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1217
+
1218
+ let { method, body, index, ...querystring } = params
1219
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1220
+
1221
+ let path = ''
1222
+ if ((index) != null) {
1223
+ if (method == null) method = 'GET'
1224
+ path = '/' + encodeURIComponent(index) + '/' + '_shard_stores'
1225
+ } else {
1226
+ if (method == null) method = 'GET'
1227
+ path = '/' + '_shard_stores'
1228
+ }
1229
+
1230
+ // build request object
1231
+ const request = {
1232
+ method,
1233
+ path,
1234
+ body: null,
1235
+ querystring
1236
+ }
1237
+
1238
+ return this.transport.request(request, options, callback)
1239
+ }
1240
+
1241
+ IndicesApi.prototype.shrink = function indicesShrinkApi (params, options, callback) {
1242
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1243
+
1244
+ // check required parameters
1245
+ if (params.index == null) {
1246
+ const err = new this[kConfigurationError]('Missing required parameter: index')
1247
+ return handleError(err, callback)
1248
+ }
1249
+ if (params.target == null) {
1250
+ const err = new this[kConfigurationError]('Missing required parameter: target')
1251
+ return handleError(err, callback)
1252
+ }
1253
+
1254
+ // check required url components
1255
+ if (params.target != null && (params.index == null)) {
1256
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
1257
+ return handleError(err, callback)
1258
+ }
1259
+
1260
+ let { method, body, index, target, ...querystring } = params
1261
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1262
+
1263
+ let path = ''
1264
+ if (method == null) method = 'PUT'
1265
+ path = '/' + encodeURIComponent(index) + '/' + '_shrink' + '/' + encodeURIComponent(target)
1266
+
1267
+ // build request object
1268
+ const request = {
1269
+ method,
1270
+ path,
1271
+ body: body || '',
1272
+ querystring
1273
+ }
1274
+
1275
+ return this.transport.request(request, options, callback)
1276
+ }
1277
+
1278
+ IndicesApi.prototype.simulateIndexTemplate = function indicesSimulateIndexTemplateApi (params, options, callback) {
1279
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1280
+
1281
+ // check required parameters
1282
+ if (params.name == null) {
1283
+ const err = new this[kConfigurationError]('Missing required parameter: name')
1284
+ return handleError(err, callback)
1285
+ }
1286
+
1287
+ let { method, body, name, ...querystring } = params
1288
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1289
+
1290
+ let path = ''
1291
+ if (method == null) method = 'POST'
1292
+ path = '/' + '_index_template' + '/' + '_simulate_index' + '/' + encodeURIComponent(name)
1293
+
1294
+ // build request object
1295
+ const request = {
1296
+ method,
1297
+ path,
1298
+ body: body || '',
1299
+ querystring
1300
+ }
1301
+
1302
+ return this.transport.request(request, options, callback)
1303
+ }
1304
+
1305
+ IndicesApi.prototype.simulateTemplate = function indicesSimulateTemplateApi (params, options, callback) {
1306
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1307
+
1308
+ let { method, body, name, ...querystring } = params
1309
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1310
+
1311
+ let path = ''
1312
+ if ((name) != null) {
1313
+ if (method == null) method = 'POST'
1314
+ path = '/' + '_index_template' + '/' + '_simulate' + '/' + encodeURIComponent(name)
1315
+ } else {
1316
+ if (method == null) method = 'POST'
1317
+ path = '/' + '_index_template' + '/' + '_simulate'
1318
+ }
1319
+
1320
+ // build request object
1321
+ const request = {
1322
+ method,
1323
+ path,
1324
+ body: body || '',
1325
+ querystring
1326
+ }
1327
+
1328
+ return this.transport.request(request, options, callback)
1329
+ }
1330
+
1331
+ IndicesApi.prototype.split = function indicesSplitApi (params, options, callback) {
1332
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1333
+
1334
+ // check required parameters
1335
+ if (params.index == null) {
1336
+ const err = new this[kConfigurationError]('Missing required parameter: index')
1337
+ return handleError(err, callback)
1338
+ }
1339
+ if (params.target == null) {
1340
+ const err = new this[kConfigurationError]('Missing required parameter: target')
1341
+ return handleError(err, callback)
1342
+ }
1343
+
1344
+ // check required url components
1345
+ if (params.target != null && (params.index == null)) {
1346
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
1347
+ return handleError(err, callback)
1348
+ }
1349
+
1350
+ let { method, body, index, target, ...querystring } = params
1351
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1352
+
1353
+ let path = ''
1354
+ if (method == null) method = 'PUT'
1355
+ path = '/' + encodeURIComponent(index) + '/' + '_split' + '/' + encodeURIComponent(target)
1356
+
1357
+ // build request object
1358
+ const request = {
1359
+ method,
1360
+ path,
1361
+ body: body || '',
1362
+ querystring
1363
+ }
1364
+
1365
+ return this.transport.request(request, options, callback)
1366
+ }
1367
+
1368
+ IndicesApi.prototype.stats = function indicesStatsApi (params, options, callback) {
1369
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1370
+
1371
+ let { method, body, metric, index, ...querystring } = params
1372
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1373
+
1374
+ let path = ''
1375
+ if ((index) != null && (metric) != null) {
1376
+ if (method == null) method = 'GET'
1377
+ path = '/' + encodeURIComponent(index) + '/' + '_stats' + '/' + encodeURIComponent(metric)
1378
+ } else if ((metric) != null) {
1379
+ if (method == null) method = 'GET'
1380
+ path = '/' + '_stats' + '/' + encodeURIComponent(metric)
1381
+ } else if ((index) != null) {
1382
+ if (method == null) method = 'GET'
1383
+ path = '/' + encodeURIComponent(index) + '/' + '_stats'
1384
+ } else {
1385
+ if (method == null) method = 'GET'
1386
+ path = '/' + '_stats'
1387
+ }
1388
+
1389
+ // build request object
1390
+ const request = {
1391
+ method,
1392
+ path,
1393
+ body: null,
1394
+ querystring
1395
+ }
1396
+
1397
+ return this.transport.request(request, options, callback)
1398
+ }
1399
+
1400
+ IndicesApi.prototype.updateAliases = function indicesUpdateAliasesApi (params, options, callback) {
1401
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1402
+
1403
+ // check required parameters
1404
+ if (params.body == null) {
1405
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1406
+ return handleError(err, callback)
1407
+ }
1408
+
1409
+ let { method, body, ...querystring } = params
1410
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1411
+
1412
+ let path = ''
1413
+ if (method == null) method = 'POST'
1414
+ path = '/' + '_aliases'
1415
+
1416
+ // build request object
1417
+ const request = {
1418
+ method,
1419
+ path,
1420
+ body: body || '',
1421
+ querystring
1422
+ }
1423
+
1424
+ return this.transport.request(request, options, callback)
1425
+ }
1426
+
1427
+ IndicesApi.prototype.upgrade = function indicesUpgradeApi (params, options, callback) {
1428
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1429
+
1430
+ let { method, body, index, ...querystring } = params
1431
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1432
+
1433
+ let path = ''
1434
+ if (method == null) method = 'POST'
1435
+ path = '/' + encodeURIComponent(index) + '/' + '_upgrade'
1436
+
1437
+ // build request object
1438
+ const request = {
1439
+ method,
1440
+ path,
1441
+ body: body || '',
1442
+ querystring
1443
+ }
1444
+
1445
+ return this.transport.request(request, options, callback)
1446
+ }
1447
+
1448
+ IndicesApi.prototype.validateQuery = function indicesValidateQueryApi (params, options, callback) {
1449
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1450
+
1451
+ // check required url components
1452
+ if (params.type != null && (params.index == null)) {
1453
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
1454
+ return handleError(err, callback)
1455
+ }
1456
+
1457
+ let { method, body, index, type, ...querystring } = params
1458
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1459
+
1460
+ let path = ''
1461
+ if ((index) != null && (type) != null) {
1462
+ if (method == null) method = body == null ? 'GET' : 'POST'
1463
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_validate' + '/' + 'query'
1464
+ } else if ((index) != null) {
1465
+ if (method == null) method = body == null ? 'GET' : 'POST'
1466
+ path = '/' + encodeURIComponent(index) + '/' + '_validate' + '/' + 'query'
1467
+ } else {
1468
+ if (method == null) method = body == null ? 'GET' : 'POST'
1469
+ path = '/' + '_validate' + '/' + 'query'
1470
+ }
1471
+
1472
+ // build request object
1473
+ const request = {
1474
+ method,
1475
+ path,
1476
+ body: body || '',
1477
+ querystring
1478
+ }
1479
+
1480
+ return this.transport.request(request, options, callback)
1481
+ }
1482
+
1483
+ Object.defineProperties(IndicesApi.prototype, {
1484
+ add_block: { get () { return this.addBlock } },
1485
+ clear_cache: { get () { return this.clearCache } },
1486
+ delete_alias: { get () { return this.deleteAlias } },
1487
+ delete_index_template: { get () { return this.deleteIndexTemplate } },
1488
+ delete_template: { get () { return this.deleteTemplate } },
1489
+ disk_usage: { get () { return this.diskUsage } },
1490
+ exists_alias: { get () { return this.existsAlias } },
1491
+ exists_index_template: { get () { return this.existsIndexTemplate } },
1492
+ exists_template: { get () { return this.existsTemplate } },
1493
+ exists_type: { get () { return this.existsType } },
1494
+ field_usage_stats: { get () { return this.fieldUsageStats } },
1495
+ flush_synced: { get () { return this.flushSynced } },
1496
+ get_alias: { get () { return this.getAlias } },
1497
+ get_field_mapping: { get () { return this.getFieldMapping } },
1498
+ get_index_template: { get () { return this.getIndexTemplate } },
1499
+ get_mapping: { get () { return this.getMapping } },
1500
+ get_settings: { get () { return this.getSettings } },
1501
+ get_template: { get () { return this.getTemplate } },
1502
+ get_upgrade: { get () { return this.getUpgrade } },
1503
+ put_alias: { get () { return this.putAlias } },
1504
+ put_index_template: { get () { return this.putIndexTemplate } },
1505
+ put_mapping: { get () { return this.putMapping } },
1506
+ put_settings: { get () { return this.putSettings } },
1507
+ put_template: { get () { return this.putTemplate } },
1508
+ resolve_index: { get () { return this.resolveIndex } },
1509
+ shard_stores: { get () { return this.shardStores } },
1510
+ simulate_index_template: { get () { return this.simulateIndexTemplate } },
1511
+ simulate_template: { get () { return this.simulateTemplate } },
1512
+ update_aliases: { get () { return this.updateAliases } },
1513
+ validate_query: { get () { return this.validateQuery } }
1514
+ })
1515
+
1516
+ module.exports = IndicesApi