@opensearch-project/opensearch 2.1.0 → 2.2.1

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 (83) hide show
  1. package/.eslintrc.json +4 -1
  2. package/CHANGELOG.md +125 -6
  3. package/DEVELOPER_GUIDE.md +55 -5
  4. package/MAINTAINERS.md +10 -6
  5. package/RELEASING.md +8 -1
  6. package/USER_GUIDE.md +133 -63
  7. package/api/api/bulk.js +23 -0
  8. package/api/api/cat.js +319 -0
  9. package/api/api/clear_scroll.js +14 -0
  10. package/api/api/cluster.js +237 -0
  11. package/api/api/count.js +28 -0
  12. package/api/api/create.js +26 -0
  13. package/api/api/create_pit.js +88 -0
  14. package/api/api/dangling_indices.js +45 -0
  15. package/api/api/delete.js +23 -0
  16. package/api/api/delete_all_pits.js +53 -0
  17. package/api/api/delete_by_query.js +48 -0
  18. package/api/api/delete_by_query_rethrottle.js +14 -0
  19. package/api/api/delete_pit.js +61 -0
  20. package/api/api/delete_script.js +14 -0
  21. package/api/api/exists.js +25 -0
  22. package/api/api/exists_source.js +25 -0
  23. package/api/api/explain.js +27 -0
  24. package/api/api/features.js +24 -0
  25. package/api/api/field_caps.js +19 -0
  26. package/api/api/get.js +25 -0
  27. package/api/api/get_all_pits.js +53 -0
  28. package/api/api/get_script.js +16 -0
  29. package/api/api/get_script_context.js +11 -0
  30. package/api/api/get_script_languages.js +11 -0
  31. package/api/api/get_source.js +25 -0
  32. package/api/api/index.js +29 -0
  33. package/api/api/indices.js +815 -0
  34. package/api/api/info.js +11 -0
  35. package/api/api/ingest.js +89 -0
  36. package/api/api/mget.js +24 -0
  37. package/api/api/msearch.js +22 -0
  38. package/api/api/msearch_template.js +19 -0
  39. package/api/api/nodes.js +91 -0
  40. package/api/api/ping.js +11 -0
  41. package/api/api/put_script.js +17 -0
  42. package/api/api/rank_eval.js +19 -0
  43. package/api/api/reindex.js +22 -0
  44. package/api/api/reindex_rethrottle.js +14 -0
  45. package/api/api/render_search_template.js +14 -0
  46. package/api/api/scripts_painless_execute.js +13 -0
  47. package/api/api/scroll.js +17 -0
  48. package/api/api/search.js +60 -0
  49. package/api/api/search_shards.js +19 -0
  50. package/api/api/search_template.js +27 -0
  51. package/api/api/shutdown.js +3 -0
  52. package/api/api/snapshot.js +210 -0
  53. package/api/api/tasks.js +56 -0
  54. package/api/api/terms_enum.js +1 -0
  55. package/api/api/termvectors.js +26 -0
  56. package/api/api/update.js +28 -0
  57. package/api/api/update_by_query.js +50 -0
  58. package/api/api/update_by_query_rethrottle.js +14 -0
  59. package/api/index.js +28 -0
  60. package/api/new.d.ts +64 -0
  61. package/api/opensearch_dashboards.d.ts +4 -0
  62. package/api/requestParams.d.ts +16 -0
  63. package/api/types.d.ts +53 -6
  64. package/guides/advanced_index_actions.md +91 -0
  65. package/guides/bulk.md +166 -0
  66. package/guides/document_lifecycle.md +162 -0
  67. package/guides/index_lifecycle.md +152 -0
  68. package/guides/index_template.md +228 -0
  69. package/guides/search.md +217 -0
  70. package/index.d.ts +160 -0
  71. package/jenkins/release.JenkinsFile +2 -2
  72. package/lib/Connection.js +1 -1
  73. package/lib/Serializer.js +2 -2
  74. package/lib/Transport.js +23 -1
  75. package/lib/aws/AwsSigv4Signer.js +14 -5
  76. package/lib/aws/index.d.ts +1 -0
  77. package/lib/errors.d.ts +2 -2
  78. package/lib/errors.js +2 -2
  79. package/lib/pool/BaseConnectionPool.js +18 -9
  80. package/lib/pool/CloudConnectionPool.js +2 -2
  81. package/lib/pool/ConnectionPool.js +4 -4
  82. package/lib/pool/index.d.ts +35 -6
  83. package/package.json +13 -12
@@ -32,6 +32,8 @@
32
32
  /* eslint camelcase: 0 */
33
33
  /* eslint no-unused-vars: 0 */
34
34
 
35
+ /** @namespace API-Cluster */
36
+
35
37
  const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
38
  const acceptedQuerystring = [
37
39
  'include_yes_decisions',
@@ -100,6 +102,26 @@ function ClusterApi(transport, ConfigurationError) {
100
102
  this[kConfigurationError] = ConfigurationError;
101
103
  }
102
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
+ */
103
125
  ClusterApi.prototype.allocationExplain = function clusterAllocationExplainApi(
104
126
  params,
105
127
  options,
@@ -125,6 +147,19 @@ ClusterApi.prototype.allocationExplain = function clusterAllocationExplainApi(
125
147
  return this.transport.request(request, options, callback);
126
148
  };
127
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
+ */
128
163
  ClusterApi.prototype.deleteComponentTemplate = function clusterDeleteComponentTemplateApi(
129
164
  params,
130
165
  options,
@@ -156,6 +191,19 @@ ClusterApi.prototype.deleteComponentTemplate = function clusterDeleteComponentTe
156
191
  return this.transport.request(request, options, callback);
157
192
  };
158
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
+ */
159
207
  ClusterApi.prototype.deleteVotingConfigExclusions = function clusterDeleteVotingConfigExclusionsApi(
160
208
  params,
161
209
  options,
@@ -181,6 +229,19 @@ ClusterApi.prototype.deleteVotingConfigExclusions = function clusterDeleteVoting
181
229
  return this.transport.request(request, options, callback);
182
230
  };
183
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
+ */
184
245
  ClusterApi.prototype.existsComponentTemplate = function clusterExistsComponentTemplateApi(
185
246
  params,
186
247
  options,
@@ -212,6 +273,19 @@ ClusterApi.prototype.existsComponentTemplate = function clusterExistsComponentTe
212
273
  return this.transport.request(request, options, callback);
213
274
  };
214
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
+ */
215
289
  ClusterApi.prototype.getComponentTemplate = function clusterGetComponentTemplateApi(
216
290
  params,
217
291
  options,
@@ -242,6 +316,21 @@ ClusterApi.prototype.getComponentTemplate = function clusterGetComponentTemplate
242
316
  return this.transport.request(request, options, callback);
243
317
  };
244
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
+ */
245
334
  ClusterApi.prototype.getSettings = function clusterGetSettingsApi(params, options, callback) {
246
335
  [params, options, callback] = normalizeArguments(params, options, callback);
247
336
 
@@ -263,6 +352,30 @@ ClusterApi.prototype.getSettings = function clusterGetSettingsApi(params, option
263
352
  return this.transport.request(request, options, callback);
264
353
  };
265
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
+ */
266
379
  ClusterApi.prototype.health = function clusterHealthApi(params, options, callback) {
267
380
  [params, options, callback] = normalizeArguments(params, options, callback);
268
381
 
@@ -289,6 +402,19 @@ ClusterApi.prototype.health = function clusterHealthApi(params, options, callbac
289
402
  return this.transport.request(request, options, callback);
290
403
  };
291
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
+ */
292
418
  ClusterApi.prototype.pendingTasks = function clusterPendingTasksApi(params, options, callback) {
293
419
  [params, options, callback] = normalizeArguments(params, options, callback);
294
420
 
@@ -310,6 +436,19 @@ ClusterApi.prototype.pendingTasks = function clusterPendingTasksApi(params, opti
310
436
  return this.transport.request(request, options, callback);
311
437
  };
312
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
+ */
313
452
  ClusterApi.prototype.postVotingConfigExclusions = function clusterPostVotingConfigExclusionsApi(
314
453
  params,
315
454
  options,
@@ -335,6 +474,22 @@ ClusterApi.prototype.postVotingConfigExclusions = function clusterPostVotingConf
335
474
  return this.transport.request(request, options, callback);
336
475
  };
337
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
+ */
338
493
  ClusterApi.prototype.putComponentTemplate = function clusterPutComponentTemplateApi(
339
494
  params,
340
495
  options,
@@ -370,6 +525,22 @@ ClusterApi.prototype.putComponentTemplate = function clusterPutComponentTemplate
370
525
  return this.transport.request(request, options, callback);
371
526
  };
372
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
+ */
373
544
  ClusterApi.prototype.putSettings = function clusterPutSettingsApi(params, options, callback) {
374
545
  [params, options, callback] = normalizeArguments(params, options, callback);
375
546
 
@@ -397,6 +568,17 @@ ClusterApi.prototype.putSettings = function clusterPutSettingsApi(params, option
397
568
  return this.transport.request(request, options, callback);
398
569
  };
399
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
+ */
400
582
  ClusterApi.prototype.remoteInfo = function clusterRemoteInfoApi(params, options, callback) {
401
583
  [params, options, callback] = normalizeArguments(params, options, callback);
402
584
 
@@ -418,6 +600,23 @@ ClusterApi.prototype.remoteInfo = function clusterRemoteInfoApi(params, options,
418
600
  return this.transport.request(request, options, callback);
419
601
  };
420
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
+ */
421
620
  ClusterApi.prototype.reroute = function clusterRerouteApi(params, options, callback) {
422
621
  [params, options, callback] = normalizeArguments(params, options, callback);
423
622
 
@@ -439,6 +638,28 @@ ClusterApi.prototype.reroute = function clusterRerouteApi(params, options, callb
439
638
  return this.transport.request(request, options, callback);
440
639
  };
441
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
+ */
442
663
  ClusterApi.prototype.state = function clusterStateApi(params, options, callback) {
443
664
  [params, options, callback] = normalizeArguments(params, options, callback);
444
665
 
@@ -482,6 +703,22 @@ ClusterApi.prototype.state = function clusterStateApi(params, options, callback)
482
703
  return this.transport.request(request, options, callback);
483
704
  };
484
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
+
485
722
  ClusterApi.prototype.stats = function clusterStatsApi(params, options, callback) {
486
723
  [params, options, callback] = normalizeArguments(params, options, callback);
487
724
 
package/api/api/count.js CHANGED
@@ -32,6 +32,8 @@
32
32
  /* eslint camelcase: 0 */
33
33
  /* eslint no-unused-vars: 0 */
34
34
 
35
+ /** @namespace API-Count */
36
+
35
37
  const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
38
  const acceptedQuerystring = [
37
39
  'ignore_unavailable',
@@ -67,6 +69,32 @@ const snakeCase = {
67
69
  filterPath: 'filter_path',
68
70
  };
69
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
+
70
98
  function countApi(params, options, callback) {
71
99
  [params, options, callback] = normalizeArguments(params, options, callback);
72
100
 
package/api/api/create.js CHANGED
@@ -54,6 +54,32 @@ const snakeCase = {
54
54
  filterPath: 'filter_path',
55
55
  };
56
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
+ */
57
83
  function createApi(params, options, callback) {
58
84
  [params, options, callback] = normalizeArguments(params, options, callback);
59
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;
@@ -32,6 +32,8 @@
32
32
  /* eslint camelcase: 0 */
33
33
  /* eslint no-unused-vars: 0 */
34
34
 
35
+ /** @namespace API-Dangling-Indices */
36
+
35
37
  const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
38
  const acceptedQuerystring = [
37
39
  'accept_data_loss',
@@ -57,6 +59,22 @@ function DanglingIndicesApi(transport, ConfigurationError) {
57
59
  this[kConfigurationError] = ConfigurationError;
58
60
  }
59
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
+ */
60
78
  DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDeleteDanglingIndexApi(
61
79
  params,
62
80
  options,
@@ -90,6 +108,22 @@ DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDelet
90
108
  return this.transport.request(request, options, callback);
91
109
  };
92
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
+ */
93
127
  DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImportDanglingIndexApi(
94
128
  params,
95
129
  options,
@@ -123,6 +157,17 @@ DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImpor
123
157
  return this.transport.request(request, options, callback);
124
158
  };
125
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
+ */
126
171
  DanglingIndicesApi.prototype.listDanglingIndices = function danglingIndicesListDanglingIndicesApi(
127
172
  params,
128
173
  options,
package/api/api/delete.js CHANGED
@@ -57,6 +57,29 @@ const snakeCase = {
57
57
  filterPath: 'filter_path',
58
58
  };
59
59
 
60
+ /**
61
+ * Delete a document
62
+ * <br/> See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/update-document/ OpenSearch - Update Document}
63
+ *
64
+ * @memberOf API-Document
65
+ *
66
+ * @param {Object} params
67
+ * @param {string} params.index - Name of the index.
68
+ * @param {string} params.id - A unique identifier to attach to the document.
69
+ * @param {number} [params.if_seq_no] - Only perform the delete operation if the document has the specified sequence number.
70
+ * @param {number} [params.if_primary_term] - Only perform the delete operation if the document has the specified primary term.
71
+ * @param {string} [params.routing] - Value used to assign the index operation to a specific shard.
72
+ * @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.
73
+ * @param {string} [params.timeout=1m] - How long to wait for a response from the cluster.
74
+ * @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.
75
+ * @param {number} [params.version] - The document’s version number.
76
+ * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte')
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/update-document/#response Update Response}
82
+ */
60
83
  function deleteApi(params, options, callback) {
61
84
  [params, options, callback] = normalizeArguments(params, options, callback);
62
85
 
@@ -0,0 +1,53 @@
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
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
17
+ const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path'];
18
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' };
19
+
20
+ /**
21
+ * Deletes all PITs in the OpenSearch cluster. The Delete All PITs API deletes only local PITs or mixed PITs (PITs created in both local and remote clusters). It does not delete fully remote PITs.
22
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#delete-pits|Opensearch - Delete PITs}
23
+ * @memberOf API-PIT
24
+ *
25
+ * @param {Object} params
26
+ *
27
+ * @param {Object} [options] - Options for {@link Transport#request}
28
+ * @param {function} [callback] - Callback that handles errors and response
29
+ *
30
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#sample-response-2|Delete all PITs Response}
31
+ */
32
+ function deleteAllPitsApi(params, options, callback) {
33
+ [params, options, callback] = normalizeArguments(params, options, callback);
34
+
35
+ let { method, body, ...querystring } = params;
36
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
37
+
38
+ let path = '';
39
+ if (method == null) method = 'DELETE';
40
+ path = '/' + '_search' + '/' + 'point_in_time' + '/' + '_all';
41
+
42
+ // build request object
43
+ const request = {
44
+ method,
45
+ path,
46
+ body: body || '',
47
+ querystring,
48
+ };
49
+
50
+ return this.transport.request(request, options, callback);
51
+ }
52
+
53
+ module.exports = deleteAllPitsApi;