@opensearch-project/opensearch 2.0.0 → 2.2.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 (92) hide show
  1. package/.eslintrc.json +13 -5
  2. package/ADMINS.md +13 -38
  3. package/CHANGELOG.md +54 -0
  4. package/COMPATIBILITY.md +4 -1
  5. package/MAINTAINERS.md +11 -73
  6. package/Makefile +2 -12
  7. package/README.md +4 -107
  8. package/RELEASING.md +7 -1
  9. package/USER_GUIDE.md +248 -0
  10. package/api/api/bulk.js +24 -2
  11. package/api/api/cat.js +320 -2
  12. package/api/api/clear_scroll.js +15 -2
  13. package/api/api/cluster.js +238 -2
  14. package/api/api/count.js +29 -2
  15. package/api/api/create.js +27 -2
  16. package/api/api/create_pit.js +88 -0
  17. package/api/api/dangling_indices.js +46 -2
  18. package/api/api/delete.js +24 -2
  19. package/api/api/delete_all_pits.js +53 -0
  20. package/api/api/delete_by_query.js +49 -2
  21. package/api/api/delete_by_query_rethrottle.js +15 -2
  22. package/api/api/delete_pit.js +61 -0
  23. package/api/api/delete_script.js +15 -2
  24. package/api/api/exists.js +26 -2
  25. package/api/api/exists_source.js +26 -2
  26. package/api/api/explain.js +28 -2
  27. package/api/api/features.js +25 -2
  28. package/api/api/field_caps.js +20 -2
  29. package/api/api/get.js +26 -2
  30. package/api/api/get_all_pits.js +53 -0
  31. package/api/api/get_script.js +17 -2
  32. package/api/api/get_script_context.js +12 -2
  33. package/api/api/get_script_languages.js +12 -2
  34. package/api/api/get_source.js +26 -2
  35. package/api/api/index.js +30 -2
  36. package/api/api/indices.js +816 -2
  37. package/api/api/info.js +12 -2
  38. package/api/api/ingest.js +90 -2
  39. package/api/api/mget.js +25 -2
  40. package/api/api/msearch.js +23 -2
  41. package/api/api/msearch_template.js +20 -2
  42. package/api/api/mtermvectors.js +1 -2
  43. package/api/api/nodes.js +92 -2
  44. package/api/api/ping.js +12 -2
  45. package/api/api/put_script.js +18 -2
  46. package/api/api/rank_eval.js +20 -2
  47. package/api/api/reindex.js +23 -2
  48. package/api/api/reindex_rethrottle.js +15 -2
  49. package/api/api/render_search_template.js +15 -2
  50. package/api/api/scripts_painless_execute.js +14 -2
  51. package/api/api/scroll.js +18 -2
  52. package/api/api/search.js +61 -2
  53. package/api/api/search_shards.js +20 -2
  54. package/api/api/search_template.js +28 -2
  55. package/api/api/shutdown.js +4 -2
  56. package/api/api/snapshot.js +211 -2
  57. package/api/api/tasks.js +57 -2
  58. package/api/api/terms_enum.js +2 -2
  59. package/api/api/termvectors.js +27 -2
  60. package/api/api/update.js +29 -2
  61. package/api/api/update_by_query.js +51 -2
  62. package/api/api/update_by_query_rethrottle.js +15 -2
  63. package/api/index.js +29 -2
  64. package/api/new.d.ts +65 -2
  65. package/api/opensearch_dashboards.d.ts +5 -2
  66. package/api/requestParams.d.ts +17 -2
  67. package/api/types.d.ts +48 -2
  68. package/api/utils.js +1 -2
  69. package/index.d.ts +605 -120
  70. package/index.js +2 -3
  71. package/index.mjs +1 -2
  72. package/jenkins/release.JenkinsFile +11 -0
  73. package/lib/Connection.d.ts +1 -2
  74. package/lib/Connection.js +5 -4
  75. package/lib/Helpers.d.ts +5 -4
  76. package/lib/Helpers.js +13 -17
  77. package/lib/Serializer.d.ts +1 -2
  78. package/lib/Serializer.js +2 -3
  79. package/lib/Transport.d.ts +10 -4
  80. package/lib/Transport.js +34 -7
  81. package/lib/aws/AwsSigv4Signer.js +176 -0
  82. package/lib/aws/errors.js +24 -0
  83. package/lib/aws/index.d.ts +39 -0
  84. package/lib/aws/index.js +19 -0
  85. package/lib/errors.d.ts +1 -2
  86. package/lib/errors.js +1 -2
  87. package/lib/pool/BaseConnectionPool.js +1 -2
  88. package/lib/pool/CloudConnectionPool.js +1 -2
  89. package/lib/pool/ConnectionPool.js +1 -2
  90. package/lib/pool/index.d.ts +1 -2
  91. package/lib/pool/index.js +1 -2
  92. package/package.json +36 -18
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -33,6 +32,8 @@
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
35
+ /** @namespace API-Cluster */
36
+
36
37
  const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
37
38
  const acceptedQuerystring = [
38
39
  'include_yes_decisions',
@@ -101,6 +102,26 @@ function ClusterApi(transport, ConfigurationError) {
101
102
  this[kConfigurationError] = ConfigurationError;
102
103
  }
103
104
 
105
+ /**
106
+ * The most basic cluster allocation explain request finds an unassigned shard and explains why it can’t be allocated to a node. If you add some options, you can instead get information on a specific shard, including why OpenSearch assigned it to its current node.
107
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/cluster-allocation/ OpenSearch - Cluster allocation explain}
108
+ *
109
+ * @memberOf API-Cluster
110
+ *
111
+ * @param {Object} params
112
+ * @param {boolean} [params.include_yes_decisions=false] - OpenSearch makes a series of yes or no decisions when trying to allocate a shard to a node. If this parameter is true, OpenSearch includes the (generally more numerous) “yes” decisions in its response.
113
+ * @param {boolean} [params.include_disk_info=false] - Whether to include information about disk usage in the response.
114
+ * @param {Object} [params.body]
115
+ * @param {string} [params.body.current_node] - If you only want an explanation if the shard happens to be on a particular node, specify that node name here.
116
+ * @param {string} [params.body.index] - The name of the shard’s index.
117
+ * @param {boolean} [params.body.primary] - Whether to provide an explanation for the primary shard (true) or its first replica (false), which share the same shard ID.
118
+ * @param {number} [params.body.shard] - The shard ID that you want an explanation for.
119
+ *
120
+ * @param {Object} options - Options for {@link Transport#request}
121
+ * @param {function} callback - Callback that handles errors and response
122
+ *
123
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/latest/api-reference/cluster-allocation/#response Cluster allocation explain Response}
124
+ */
104
125
  ClusterApi.prototype.allocationExplain = function clusterAllocationExplainApi(
105
126
  params,
106
127
  options,
@@ -126,6 +147,19 @@ ClusterApi.prototype.allocationExplain = function clusterAllocationExplainApi(
126
147
  return this.transport.request(request, options, callback);
127
148
  };
128
149
 
150
+ /**
151
+ * Delete Component Template(s)
152
+ *
153
+ * @memberOf API-Cluster
154
+ *
155
+ * @param {Object} params
156
+ * @param {string} [params.name] The name of the component template to be deleted.
157
+ *
158
+ * @param {Object} options - Options for {@link Transport#request}
159
+ * @param {function} callback - Callback that handles errors and response
160
+ *
161
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
162
+ */
129
163
  ClusterApi.prototype.deleteComponentTemplate = function clusterDeleteComponentTemplateApi(
130
164
  params,
131
165
  options,
@@ -157,6 +191,19 @@ ClusterApi.prototype.deleteComponentTemplate = function clusterDeleteComponentTe
157
191
  return this.transport.request(request, options, callback);
158
192
  };
159
193
 
194
+ /**
195
+ * Clears cluster voting config exclusions.
196
+ *
197
+ * @memberOf API-Cluster
198
+ *
199
+ * @param {Object} params
200
+ * @param {boolean} [params.wait_for_removal] Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list.
201
+ *
202
+ * @param {Object} options - Options for {@link Transport#request}
203
+ * @param {function} callback - Callback that handles errors and response
204
+ *
205
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
206
+ */
160
207
  ClusterApi.prototype.deleteVotingConfigExclusions = function clusterDeleteVotingConfigExclusionsApi(
161
208
  params,
162
209
  options,
@@ -182,6 +229,19 @@ ClusterApi.prototype.deleteVotingConfigExclusions = function clusterDeleteVoting
182
229
  return this.transport.request(request, options, callback);
183
230
  };
184
231
 
232
+ /**
233
+ * Information about whether a particular component template exist
234
+ *
235
+ * @memberOf API-Cluster
236
+ *
237
+ * @param {Object} params
238
+ * @param {boolean} [params.name] Name of the template
239
+ *
240
+ * @param {Object} options - Options for {@link Transport#request}
241
+ * @param {function} callback - Callback that handles errors and response
242
+ *
243
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
244
+ */
185
245
  ClusterApi.prototype.existsComponentTemplate = function clusterExistsComponentTemplateApi(
186
246
  params,
187
247
  options,
@@ -213,6 +273,19 @@ ClusterApi.prototype.existsComponentTemplate = function clusterExistsComponentTe
213
273
  return this.transport.request(request, options, callback);
214
274
  };
215
275
 
276
+ /**
277
+ * Returns one or more component templates
278
+ *
279
+ * @memberOf API-Cluster
280
+ *
281
+ * @param {Object} params
282
+ * @param {string | string[]} [params.name] Name(s) of the template(s)
283
+ *
284
+ * @param {Object} options - Options for {@link Transport#request}
285
+ * @param {function} callback - Callback that handles errors and response
286
+ *
287
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
288
+ */
216
289
  ClusterApi.prototype.getComponentTemplate = function clusterGetComponentTemplateApi(
217
290
  params,
218
291
  options,
@@ -243,6 +316,21 @@ ClusterApi.prototype.getComponentTemplate = function clusterGetComponentTemplate
243
316
  return this.transport.request(request, options, callback);
244
317
  };
245
318
 
319
+ /**
320
+ * Get Cluster Settings
321
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/cluster-settings/ OpenSearch - Cluster Settings}
322
+ * @memberOf API-Cluster
323
+ *
324
+ * @param {Object} params
325
+ * ç
326
+ * @param {boolean} [params.include_defaults] Whether to include default settings as part of the response. This parameter is useful for identifying the names and current values of settings you want to update.
327
+ * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node.
328
+ *
329
+ * @param {Object} options - Options for {@link Transport#request}
330
+ * @param {function} callback - Callback that handles errors and response
331
+ *
332
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
333
+ */
246
334
  ClusterApi.prototype.getSettings = function clusterGetSettingsApi(params, options, callback) {
247
335
  [params, options, callback] = normalizeArguments(params, options, callback);
248
336
 
@@ -264,6 +352,30 @@ ClusterApi.prototype.getSettings = function clusterGetSettingsApi(params, option
264
352
  return this.transport.request(request, options, callback);
265
353
  };
266
354
 
355
+ /**
356
+ * The most basic cluster health request returns a simple status of the health of your cluster. OpenSearch expresses cluster health in three colors: green, yellow, and red. A green status means all primary shards and their replicas are allocated to nodes. A yellow status means all primary shards are allocated to nodes, but some replicas aren’t. A red status means at least one primary shard is not allocated to any node.
357
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/cluster-health/ OpenSearch - Cluster Health}
358
+ * @memberOf API-Cluster
359
+ *
360
+ * @param {Object} params
361
+ * @param {} [params.index] - To get the status of a specific index, provide the index name.
362
+ * @param {string} [params.expand_wildcards=open] - Expands wildcard expressions to concrete indices. Combine multiple values with commas. Supported values are 'all', 'open', 'closed', 'hidden', and 'none'.
363
+ * @param {string} [params.level=cluster] - The level of detail for returned health information. Supported values are 'cluster', 'indices', and 'shards'.
364
+ * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster manager node.
365
+ * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node.
366
+ * @param {string} [params.timeout=30s] - The amount of time to wait for a response from the cluster.
367
+ * @param {string} [params.wait_for_active_shards=0] - Wait until the specified number of shards is active before returning a response. 'all' for all shards
368
+ * @param {string} [params.wait_for_nodes] - Wait for N number of nodes. Use 12 for exact match, >12 and <12 for range.
369
+ * @param {string} [params.wait_for_events] - Wait until all currently queued events with the given priority are processed. Supported values are 'immediate', 'urgent', 'high', 'normal', 'low', and 'languid'.
370
+ * @param {boolean} [params.wait_for_no_relocating_shards=false] - Whether to wait until there are no relocating shards in the cluster.
371
+ * @param {boolean} [params.wait_for_no_initializing_shards=false] - Whether to wait until there are no initializing shards in the cluster.
372
+ * @param {string} [params.wait_for_status] - Wait until the cluster health reaches the specified status or better. Supported values are 'green', 'yellow', and 'red'.
373
+ *
374
+ * @param {Object} options - Options for {@link Transport#request}
375
+ * @param {function} callback - Callback that handles errors and response
376
+ *
377
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/latest/api-reference/cluster-health/#response Cluster Health Response}
378
+ */
267
379
  ClusterApi.prototype.health = function clusterHealthApi(params, options, callback) {
268
380
  [params, options, callback] = normalizeArguments(params, options, callback);
269
381
 
@@ -290,6 +402,19 @@ ClusterApi.prototype.health = function clusterHealthApi(params, options, callbac
290
402
  return this.transport.request(request, options, callback);
291
403
  };
292
404
 
405
+ /**
406
+ * Get a list of any cluster-level changes
407
+ * @memberOf API-Cluster
408
+ *
409
+ * @param {Object} params
410
+ * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster manager node.
411
+ * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node.
412
+ *
413
+ * @param {Object} options - Options for {@link Transport#request}
414
+ * @param {function} callback - Callback that handles errors and response
415
+ *
416
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
417
+ */
293
418
  ClusterApi.prototype.pendingTasks = function clusterPendingTasksApi(params, options, callback) {
294
419
  [params, options, callback] = normalizeArguments(params, options, callback);
295
420
 
@@ -311,6 +436,19 @@ ClusterApi.prototype.pendingTasks = function clusterPendingTasksApi(params, opti
311
436
  return this.transport.request(request, options, callback);
312
437
  };
313
438
 
439
+ /**
440
+ * Updates the cluster voting config exclusions by node ids or node names.
441
+ * @memberOf API-Cluster
442
+ *
443
+ * @param {Object} params
444
+ * @param {string} [params.node_names] - A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify node_names.
445
+ * @param {string} [params.node_ids] - A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify node_ids.
446
+ *
447
+ * @param {Object} options - Options for {@link Transport#request}
448
+ * @param {function} callback - Callback that handles errors and response
449
+ *
450
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
451
+ */
314
452
  ClusterApi.prototype.postVotingConfigExclusions = function clusterPostVotingConfigExclusionsApi(
315
453
  params,
316
454
  options,
@@ -336,6 +474,22 @@ ClusterApi.prototype.postVotingConfigExclusions = function clusterPostVotingConf
336
474
  return this.transport.request(request, options, callback);
337
475
  };
338
476
 
477
+ /**
478
+ * Creates or updates a component template
479
+ *
480
+ * @memberOf API-Cluster
481
+ *
482
+ * @param {Object} params
483
+ * @param {string} params.name - The name of the component template.
484
+ * @param {object} params.body - The template definition.
485
+ * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node.
486
+ * @param {boolean} [params.create=false] - Whether the index template should only be added if new or can also replace an existing one.
487
+ *
488
+ * @param {Object} options - Options for {@link Transport#request}
489
+ * @param {function} callback - Callback that handles errors and response
490
+ *
491
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
492
+ */
339
493
  ClusterApi.prototype.putComponentTemplate = function clusterPutComponentTemplateApi(
340
494
  params,
341
495
  options,
@@ -371,6 +525,22 @@ ClusterApi.prototype.putComponentTemplate = function clusterPutComponentTemplate
371
525
  return this.transport.request(request, options, callback);
372
526
  };
373
527
 
528
+ /**
529
+ * Updates the cluster settings.
530
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/cluster-settings/ OpenSearch - Cluster Settings}
531
+ * @memberOf API-Cluster
532
+ *
533
+ * @param {Object} params
534
+ * @param {boolean} [params.flat_settings] Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings.
535
+ * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node.
536
+ * @param {string} [params.timeout=30s] - The amount of time to wait for a response from the cluster.
537
+ * @param {object} params.body - The settings to be updated. Can be either 'transient' or 'persistent' (survives cluster restart).
538
+ *
539
+ * @param {Object} options - Options for {@link Transport#request}
540
+ * @param {function} callback - Callback that handles errors and response
541
+ *
542
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
543
+ */
374
544
  ClusterApi.prototype.putSettings = function clusterPutSettingsApi(params, options, callback) {
375
545
  [params, options, callback] = normalizeArguments(params, options, callback);
376
546
 
@@ -398,6 +568,17 @@ ClusterApi.prototype.putSettings = function clusterPutSettingsApi(params, option
398
568
  return this.transport.request(request, options, callback);
399
569
  };
400
570
 
571
+ /**
572
+ * This operation provides connection information for any remote OpenSearch clusters that you’ve configured for the local cluster, such as the remote cluster alias, connection mode (sniff or proxy), IP addresses for seed nodes, and timeout settings.
573
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/remote-info/ OpenSearch - Remote cluster information}
574
+ * @memberOf API-Cluster
575
+ *
576
+ * @param {Object} params - (Unused)
577
+ * @param {Object} options - Options for {@link Transport#request}
578
+ * @param {function} callback - Callback that handles errors and response
579
+ *
580
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/latest/api-reference/remote-info/#response Remote cluster information }
581
+ */
401
582
  ClusterApi.prototype.remoteInfo = function clusterRemoteInfoApi(params, options, callback) {
402
583
  [params, options, callback] = normalizeArguments(params, options, callback);
403
584
 
@@ -419,6 +600,23 @@ ClusterApi.prototype.remoteInfo = function clusterRemoteInfoApi(params, options,
419
600
  return this.transport.request(request, options, callback);
420
601
  };
421
602
 
603
+ /**
604
+ * Allows to manually change the allocation of individual shards in the cluster.
605
+ *
606
+ * @memberOf API-Cluster
607
+ *
608
+ * @param {Object} params
609
+ * @param {object} [params.body] - The definition of 'commands' to perform ('move', 'cancel', 'allocate')
610
+ * @param {boolean} [params.dry_run] - Simulate the operation only and return the resulting state
611
+ * @param {boolean} [params.explain] - Return an explanation of why the commands can or cannot be executed
612
+ * @param {boolean} [params.retry_failed] - Retries allocation of shards that are blocked due to too many subsequent allocation failures
613
+ * @param {string | string[]} [params.metric] - Limit the information returned to the specified metrics. Defaults to all but metadata (options: _all, blocks, metadata, nodes, routing_table, cluster_manager_node, version)
614
+ *
615
+ * @param {Object} options - Options for {@link Transport#request}
616
+ * @param {function} callback - Callback that handles errors and response
617
+ *
618
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
619
+ */
422
620
  ClusterApi.prototype.reroute = function clusterRerouteApi(params, options, callback) {
423
621
  [params, options, callback] = normalizeArguments(params, options, callback);
424
622
 
@@ -440,6 +638,28 @@ ClusterApi.prototype.reroute = function clusterRerouteApi(params, options, callb
440
638
  return this.transport.request(request, options, callback);
441
639
  };
442
640
 
641
+ /**
642
+ * Get comprehensive information about the state of the cluster.
643
+ *
644
+ * @memberOf API-Cluster
645
+ *
646
+ * @param {Object} params
647
+ * @param {string | string[]} [params.metric] - Limit the information returned to the specified metrics. Defaults to all but metadata (options: _all, blocks, metadata, nodes, routing_table, cluster_manager_node, version).
648
+ * @param {string | string[]} [params.index] - List of index names; use '_all' or empty string to perform the operation on all indices.
649
+ * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster manager node.
650
+ * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node.
651
+ * @param {boolean} [params.flat_settings=false] - Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings.
652
+ * @param {number} [params.wait_for_metadata_version] - Wait for the metadata version to be equal or greater than the specified metadata version.
653
+ * @param {string} [params.wait_for_timeout=30s] - The maximum time to wait for wait_for_metadata_version before timing out
654
+ * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed)
655
+ * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
656
+ * @param {string} [params.expand_wildcards=open] - Expands wildcard expressions to concrete indices. Combine multiple values with commas. Supported values are 'all', 'open', 'closed', 'hidden', and 'none'. Default is 'open'.
657
+ *
658
+ * @param {Object} options - Options for {@link Transport#request}
659
+ * @param {function} callback - Callback that handles errors and response
660
+ *
661
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
662
+ */
443
663
  ClusterApi.prototype.state = function clusterStateApi(params, options, callback) {
444
664
  [params, options, callback] = normalizeArguments(params, options, callback);
445
665
 
@@ -483,6 +703,22 @@ ClusterApi.prototype.state = function clusterStateApi(params, options, callback)
483
703
  return this.transport.request(request, options, callback);
484
704
  };
485
705
 
706
+ /**
707
+ * The CAT aliases operation lists the mapping of aliases to indices, plus routing and filtering information.
708
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/cluster-stats/ OpenSearch - Cluster stats}
709
+ *
710
+ * @memberOf API-Cluster
711
+ *
712
+ * @param {Object} params
713
+ * @param {string | string[]} [params.node_id] - A comma-separated list of node IDs or names to limit the returned information; use '_local' to return information from the node you're connecting to, leave empty to get information from all nodes.
714
+ *
715
+ *
716
+ * @param {Object} [options] - Options for {@link Transport#request}
717
+ * @param {function} [callback] - Callback that handles errors and response
718
+ *
719
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/latest/api-reference/cluster-stats/#response Cluster stats Response}
720
+ */
721
+
486
722
  ClusterApi.prototype.stats = function clusterStatsApi(params, options, callback) {
487
723
  [params, options, callback] = normalizeArguments(params, options, callback);
488
724
 
package/api/api/count.js CHANGED
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -33,6 +32,8 @@
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
35
+ /** @namespace API-Count */
36
+
36
37
  const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
37
38
  const acceptedQuerystring = [
38
39
  'ignore_unavailable',
@@ -68,6 +69,32 @@ const snakeCase = {
68
69
  filterPath: 'filter_path',
69
70
  };
70
71
 
72
+ /**
73
+ * The count API gives you quick access to the number of documents that match a query. You can also use it to check the document count of an index, data stream, or cluster.
74
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/count/ OpenSearch - Bulk}
75
+ *
76
+ * @memberOf API-Count
77
+ *
78
+ * @param {Object} params
79
+ * @param {boolean} [params.allow_no_indices=false] - If false, the request returns an error if any wildcard expression or index alias targets any closed or missing indices.
80
+ * @param {string} [params.analyzer] - The analyzer to use in the query string.
81
+ * @param {boolean} [params.analyze_wildcard=false] - Specifies whether to analyze wildcard and prefix queries.
82
+ * @param {string} [params.default_operator='OR'] - Indicates whether the default operator for a string query should be 'AND' or 'OR'.
83
+ * @param {string} [params.df] - The default field in case a field prefix is not provided in the query string.
84
+ * @param {string} [params.expand_wildcards=open] - Expands wildcard expressions to concrete indices. Combine multiple values with commas. Supported values are 'all', 'open', 'closed', 'hidden', and 'none'.
85
+ * @param {boolean} [params.ignore_unavailable=false] - Specifies whether to include missing or closed indices in the response.
86
+ * @param {boolean} [params.lenient=false] - Specifies whether OpenSearch should accept requests if queries have format errors (for example, querying a text field for an integer).
87
+ * @param {number} [params.min_score] - Include only documents with a minimum '_score' value in the result.
88
+ * @param {string} [params.routing] - Value used to route the operation to a specific shard.
89
+ * @param {string} [params.preference] - Specifies which shard or node OpenSearch should perform the count operation on.
90
+ * @param {number} [params.terminate_after] - The maximum number of documents OpenSearch should process before terminating the request.
91
+ *
92
+ * @param {Object} options - Options for {@link Transport#request}
93
+ * @param {function} callback - Callback that handles errors and response
94
+ *
95
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/latest/api-reference/count/#response Count Response}
96
+ */
97
+
71
98
  function countApi(params, options, callback) {
72
99
  [params, options, callback] = normalizeArguments(params, options, callback);
73
100
 
package/api/api/create.js CHANGED
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -55,6 +54,32 @@ const snakeCase = {
55
54
  filterPath: 'filter_path',
56
55
  };
57
56
 
57
+ /**
58
+ * Adds a document with a predefined ID to an index.
59
+ * <br/> See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/index-document/ OpenSearch - Index Document}
60
+ *
61
+ * @memberOf API-Document
62
+ *
63
+ * @param {Object} params
64
+ * @param {string} params.index - Name of the index.
65
+ * @param {string} params.id - A unique identifier to attach to the document.
66
+ * @param {Object} params.body - The content of the document.
67
+ * @param {number} [params.if_seq_no] - Only perform the index operation if the document has the specified sequence number.
68
+ * @param {number} [params.if_primary_term] - Only perform the index operation if the document has the specified primary term.
69
+ * @param {string} [params.pipeline] - Route the index operation to a certain pipeline.
70
+ * @param {string} [params.routing] - value used to assign the index operation to a specific shard.
71
+ * @param {string} [params.refresh=false] - If true, OpenSearch refreshes shards to make the operation visible to searching. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation.
72
+ * @param {string} [params.timeout=1m] - How long to wait for a response from the cluster.
73
+ * @param {number} [params.version] - The document’s version number.
74
+ * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte')
75
+ * @param {string} [params.wait_for_active_shards] - The number of active shards that must be available before OpenSearch processes the request. Default is 1 (only the primary shard). Set to all or a positive integer. Values greater than 1 require replicas. For example, if you specify a value of 3, the index must have two replicas distributed across two additional nodes for the operation to succeed.
76
+ * @param {boolean} [params.require_alias=false] - Specifies whether the target index must be an index alias.
77
+ *
78
+ * @param {Object} options - Options for {@link Transport#request}
79
+ * @param {function} callback - Callback that handles errors and response
80
+ *
81
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/index-document/#response Index Response}
82
+ */
58
83
  function createApi(params, options, callback) {
59
84
  [params, options, callback] = normalizeArguments(params, options, callback);
60
85
 
@@ -0,0 +1,88 @@
1
+ /*
2
+ * Copyright OpenSearch Contributors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ *
5
+ * The OpenSearch Contributors require contributions made to
6
+ * this file be licensed under the Apache-2.0 license or a
7
+ * compatible open source license.
8
+ *
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ /* eslint camelcase: 0 */
14
+ /* eslint no-unused-vars: 0 */
15
+
16
+ /** @namespace API-PIT */
17
+
18
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
19
+ const acceptedQuerystring = [
20
+ 'allow_partial_pit_creation',
21
+ 'keep_alive',
22
+ 'preference',
23
+ 'routing',
24
+ 'pretty',
25
+ 'human',
26
+ 'error_trace',
27
+ 'source',
28
+ 'filter_path',
29
+ ];
30
+ const snakeCase = {
31
+ allowPartialPitCreation: 'allow_partial_pit_creation',
32
+ keepAlive: 'keep_alive',
33
+ errorTrace: 'error_trace',
34
+ filterPath: 'filter_path',
35
+ };
36
+
37
+ /**
38
+ * Creates a point in time.
39
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#create-a-pit|Opensearch - Create a PIT}
40
+ * @memberOf API-PIT
41
+ *
42
+ * @param {Object} params
43
+ * @param {string} params.index - The name(s) of the target index(es) for the PIT. May contain a comma-separated list or a wildcard index pattern.
44
+ * @param {string} params.keep_alive - The amount of time to keep the PIT
45
+ * @param {string} [params.preference=random] - The node or the shard used to perform the search.
46
+ * @param {string} [params.routing] - Specifies to route search requests to a specific shard.
47
+ * @param {string} [params.expand_wildcards=open] - The type of index that can match the wildcard pattern. Supports comma-separated values.
48
+ * @param {string} [params.allow_partial_pit_creation=false] - Specifies whether to create a PIT with partial failures.
49
+ *
50
+ * @param {Object} [options] - Options for {@link Transport#request}
51
+ * @param {function} [callback] - Callback that handles errors and response
52
+ *
53
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#sample-response|Create PIT Response}
54
+ */
55
+
56
+ function createPitApi(params, options, callback) {
57
+ [params, options, callback] = normalizeArguments(params, options, callback);
58
+
59
+ // check required parameters
60
+ if (params['index'] == null) {
61
+ const err = new this[kConfigurationError]('Missing required parameter: index');
62
+ return handleError(err, callback);
63
+ }
64
+
65
+ if (params['keep_alive'] == null) {
66
+ const err = new this[kConfigurationError]('Missing required parameter: keep_alive');
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 = 'POST';
75
+ path = '/' + encodeURIComponent(index) + '/' + '_search' + '/' + 'point_in_time';
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
+ module.exports = createPitApi;
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -33,6 +32,8 @@
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
35
+ /** @namespace API-Dangling-Indices */
36
+
36
37
  const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
37
38
  const acceptedQuerystring = [
38
39
  'accept_data_loss',
@@ -58,6 +59,22 @@ function DanglingIndicesApi(transport, ConfigurationError) {
58
59
  this[kConfigurationError] = ConfigurationError;
59
60
  }
60
61
 
62
+ /**
63
+ * Deletes the specified dangling index
64
+ * <br/> See also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/dangling-index/ OpenSearch - Dangling Indexes}
65
+ * @memberOf API-Dangling-Indices
66
+ *
67
+ * @param {Object} params
68
+ * @param {string} params.index_uuid - The UUID of the dangling index
69
+ * @param {boolean} [params.accept_data_loss] - Must be set to true in order to delete the dangling index
70
+ * @param {string} [params.timeout=30s] - Explicit operation timeout
71
+ * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager
72
+ *
73
+ * @param {Object} [options] - Options for {@link Transport#request}
74
+ * @param {function} [callback] - Callback that handles errors and response
75
+ *
76
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
77
+ */
61
78
  DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDeleteDanglingIndexApi(
62
79
  params,
63
80
  options,
@@ -91,6 +108,22 @@ DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDelet
91
108
  return this.transport.request(request, options, callback);
92
109
  };
93
110
 
111
+ /**
112
+ * Imports the specified dangling index
113
+ * <br/> See also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/dangling-index/ OpenSearch - Dangling Indexes}
114
+ * @memberOf API-Dangling-Indices
115
+ *
116
+ * @param {Object} params
117
+ * @param {string} params.index_uuid - The UUID of the dangling index
118
+ * @param {boolean} [params.accept_data_loss] - Must be set to true in order to delete the dangling index
119
+ * @param {string} [params.timeout=30s] - Explicit operation timeout
120
+ * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager
121
+ *
122
+ * @param {Object} [options] - Options for {@link Transport#request}
123
+ * @param {function} [callback] - Callback that handles errors and response
124
+ *
125
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
126
+ */
94
127
  DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImportDanglingIndexApi(
95
128
  params,
96
129
  options,
@@ -124,6 +157,17 @@ DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImpor
124
157
  return this.transport.request(request, options, callback);
125
158
  };
126
159
 
160
+ /**
161
+ * Retrieve all dangling indices.
162
+ * <br/> See also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/dangling-index/ OpenSearch - Dangling Indexes}
163
+ * @memberOf API-Dangling-Indices
164
+ *
165
+ * @param {Object} params - (Unused)
166
+ * @param {Object} [options] - Options for {@link Transport#request}
167
+ * @param {function} [callback] - Callback that handles errors and response
168
+ *
169
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
170
+ */
127
171
  DanglingIndicesApi.prototype.listDanglingIndices = function danglingIndicesListDanglingIndicesApi(
128
172
  params,
129
173
  options,