@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
@@ -54,6 +54,25 @@ const snakeCase = {
54
54
  filterPath: 'filter_path',
55
55
  };
56
56
 
57
+ /**
58
+ * Returns information about the indices and shards that a search request would be executed against.
59
+ *
60
+ * @memberOf API-Search
61
+ *
62
+ * @param {Object} params
63
+ * @param {string} [params.index] - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
64
+ * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random)
65
+ * @param {string} [params.routing] - Specific routing value
66
+ * @param {boolean} [params.local] - Return local information, do not retrieve the state from cluster_manager node (default: false)
67
+ * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed)
68
+ * @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)
69
+ * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
70
+ *
71
+ * @param {Object} options - Options for {@link Transport#request}
72
+ * @param {function} callback - Callback that handles errors and response
73
+ *
74
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
75
+ */
57
76
  function searchShardsApi(params, options, callback) {
58
77
  [params, options, callback] = normalizeArguments(params, options, callback);
59
78
 
@@ -66,6 +66,33 @@ const snakeCase = {
66
66
  filterPath: 'filter_path',
67
67
  };
68
68
 
69
+ /**
70
+ * Allows to use the Mustache language to pre-render a search definition.
71
+ *
72
+ * @memberOf API-Search
73
+ *
74
+ * @param {Object} params
75
+ * @param {string} params.index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
76
+ * @param {Object} params.body - The search definition template and its params
77
+ * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed)
78
+ * @param {boolean} [params.ignore_throttled] - Whether specified concrete, expanded or aliased indices should be ignored when throttled
79
+ * @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)
80
+ * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
81
+ * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random)
82
+ * @param {string} [params.routing] - A comma-separated list of specific routing values
83
+ * @param {string} [params.scroll] - Specify how long a consistent view of the index should be maintained for scrolled search
84
+ * @param {string} [params.search_type] - Search operation type (options: query_then_fetch, dfs_query_then_fetch)
85
+ * @param {boolean} [params.explain] - Specify whether to return detailed information about score computation as part of a hit
86
+ * @param {boolean} [params.profile] - Specify whether to profile the query execution
87
+ * @param {boolean} [params.typed_keys] - Specify whether aggregation and suggester names should be prefixed by their respective types in the response
88
+ * @param {boolean} [params.rest_total_hits_as_int] - Indicates whether hits.total should be rendered as an integer or an object in the rest search response
89
+ * @param {boolean} [params.ccs_minimize_roundtrips] - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
90
+ *
91
+ * @param {Object} options - Options for {@link Transport#request}
92
+ * @param {function} callback - Callback that handles errors and response
93
+ *
94
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
95
+ */
69
96
  function searchTemplateApi(params, options, callback) {
70
97
  [params, options, callback] = normalizeArguments(params, options, callback);
71
98
 
@@ -41,6 +41,7 @@ function ShutdownApi(transport, ConfigurationError) {
41
41
  this[kConfigurationError] = ConfigurationError;
42
42
  }
43
43
 
44
+ // TODO: Remove. Added in ES 7.15
44
45
  ShutdownApi.prototype.deleteNode = function shutdownDeleteNodeApi(params, options, callback) {
45
46
  [params, options, callback] = normalizeArguments(params, options, callback);
46
47
 
@@ -68,6 +69,7 @@ ShutdownApi.prototype.deleteNode = function shutdownDeleteNodeApi(params, option
68
69
  return this.transport.request(request, options, callback);
69
70
  };
70
71
 
72
+ // TODO: Remove. Added in ES 7.15
71
73
  ShutdownApi.prototype.getNode = function shutdownGetNodeApi(params, options, callback) {
72
74
  [params, options, callback] = normalizeArguments(params, options, callback);
73
75
 
@@ -94,6 +96,7 @@ ShutdownApi.prototype.getNode = function shutdownGetNodeApi(params, options, cal
94
96
  return this.transport.request(request, options, callback);
95
97
  };
96
98
 
99
+ // TODO: Remove. Added in ES 7.15
97
100
  ShutdownApi.prototype.putNode = function shutdownPutNodeApi(params, options, callback) {
98
101
  [params, options, callback] = normalizeArguments(params, options, callback);
99
102
 
@@ -32,6 +32,8 @@
32
32
  /* eslint camelcase: 0 */
33
33
  /* eslint no-unused-vars: 0 */
34
34
 
35
+ /** @namespace API-Snapshot */
36
+
35
37
  const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
38
  const acceptedQuerystring = [
37
39
  'cluster_manager_timeout',
@@ -83,6 +85,21 @@ function SnapshotApi(transport, ConfigurationError) {
83
85
  this[kConfigurationError] = ConfigurationError;
84
86
  }
85
87
 
88
+ /**
89
+ * Removes stale data from repository.
90
+ *
91
+ * @memberOf API-Snapshot
92
+ *
93
+ * @param {Object} params
94
+ * @param {string} params.repository - A repository name
95
+ * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node
96
+ * @param {string} [params.timeout] - Explicit operation timeout
97
+ *
98
+ * @param {Object} options - Options for {@link Transport#request}
99
+ * @param {function} callback - Callback that handles errors and response
100
+ *
101
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
102
+ */
86
103
  SnapshotApi.prototype.cleanupRepository = function snapshotCleanupRepositoryApi(
87
104
  params,
88
105
  options,
@@ -114,6 +131,23 @@ SnapshotApi.prototype.cleanupRepository = function snapshotCleanupRepositoryApi(
114
131
  return this.transport.request(request, options, callback);
115
132
  };
116
133
 
134
+ /**
135
+ * Clones indices from one snapshot into another snapshot in the same repository.
136
+ *
137
+ * @memberOf API-Snapshot
138
+ *
139
+ * @param {Object} params
140
+ * @param {string} params.repository - A repository name
141
+ * @param {string} params.snapshot - The name of the snapshot to clone from
142
+ * @param {Object} params.body - The snapshot clone definition
143
+ * @param {string} [params.target_snapshot] - The name of the cloned snapshot to create
144
+ * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node
145
+ *
146
+ * @param {Object} options - Options for {@link Transport#request}
147
+ * @param {function} callback - Callback that handles errors and response
148
+ *
149
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
150
+ */
117
151
  SnapshotApi.prototype.clone = function snapshotCloneApi(params, options, callback) {
118
152
  [params, options, callback] = normalizeArguments(params, options, callback);
119
153
 
@@ -180,6 +214,23 @@ SnapshotApi.prototype.clone = function snapshotCloneApi(params, options, callbac
180
214
  return this.transport.request(request, options, callback);
181
215
  };
182
216
 
217
+ /**
218
+ * Creates a snapshot in a repository.
219
+ *
220
+ * @memberOf API-Snapshot
221
+ *
222
+ * @param {Object} params
223
+ * @param {string} params.repository - A repository name
224
+ * @param {string} params.snapshot - A snapshot name
225
+ * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node
226
+ * @param {boolean} [params.wait_for_completion] - Should this request wait until the operation has completed before returning
227
+ * @param {Object} [params.body] - The snapshot definition
228
+ *
229
+ * @param {Object} options - Options for {@link Transport#request}
230
+ * @param {function} callback - Callback that handles errors and response
231
+ *
232
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
233
+ */
183
234
  SnapshotApi.prototype.create = function snapshotCreateApi(params, options, callback) {
184
235
  [params, options, callback] = normalizeArguments(params, options, callback);
185
236
 
@@ -218,6 +269,23 @@ SnapshotApi.prototype.create = function snapshotCreateApi(params, options, callb
218
269
  return this.transport.request(request, options, callback);
219
270
  };
220
271
 
272
+ /**
273
+ * Creates a repository.
274
+ *
275
+ * @memberOf API-Snapshot
276
+ *
277
+ * @param {Object} params
278
+ * @param {string} params.repository - A repository name
279
+ * @param {Object} params.body - The repository definition
280
+ * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node
281
+ * @param {string} [params.timeout] - Explicit operation timeout
282
+ * @param {boolean} [params.verify] - Whether to verify the repository after creation
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
+ */
221
289
  SnapshotApi.prototype.createRepository = function snapshotCreateRepositoryApi(
222
290
  params,
223
291
  options,
@@ -253,6 +321,22 @@ SnapshotApi.prototype.createRepository = function snapshotCreateRepositoryApi(
253
321
  return this.transport.request(request, options, callback);
254
322
  };
255
323
 
324
+ /**
325
+ * Deletes a snapshot.
326
+ *
327
+ * @memberOf API-Snapshot
328
+ *
329
+ * @param {Object} params
330
+ * @param {string} [params.repository] - A repository name
331
+ * @param {string} [params.snapshot] - A snapshot name
332
+ * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
333
+ * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node
334
+ *
335
+ * @param {Object} options - Options for {@link Transport#request}
336
+ * @param {function} callback - Callback that handles errors and response
337
+ *
338
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
339
+ */
256
340
  SnapshotApi.prototype.delete = function snapshotDeleteApi(params, options, callback) {
257
341
  [params, options, callback] = normalizeArguments(params, options, callback);
258
342
 
@@ -291,6 +375,22 @@ SnapshotApi.prototype.delete = function snapshotDeleteApi(params, options, callb
291
375
  return this.transport.request(request, options, callback);
292
376
  };
293
377
 
378
+ /**
379
+ * Deletes a repository.
380
+ *
381
+ * @memberOf API-Snapshot
382
+ *
383
+ * @param {Object} params
384
+ * @param {string} [params.repository] - Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported.
385
+ * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
386
+ * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node
387
+ * @param {string} [params.timeout] - Explicit operation timeout
388
+ *
389
+ * @param {Object} options - Options for {@link Transport#request}
390
+ * @param {function} callback - Callback that handles errors and response
391
+ *
392
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
393
+ */
294
394
  SnapshotApi.prototype.deleteRepository = function snapshotDeleteRepositoryApi(
295
395
  params,
296
396
  options,
@@ -322,6 +422,26 @@ SnapshotApi.prototype.deleteRepository = function snapshotDeleteRepositoryApi(
322
422
  return this.transport.request(request, options, callback);
323
423
  };
324
424
 
425
+ /**
426
+ * Returns information about a snapshot.
427
+ *
428
+ * @memberOf API-Snapshot
429
+ *
430
+ * @param {Object} params
431
+ * @param {string} [params.repository] - A repository name
432
+ * @param {string} [params.snapshot] - A comma-separated list of snapshot names
433
+ * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
434
+ * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node
435
+ * @param {boolean} [params.ignore_unavailable] - Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown
436
+ * @param {boolean} [params.index_details] - Whether to include details of each index in the snapshot, if those details are available. Defaults to false.
437
+ * @param {boolean} [params.include_repository] - Whether to include the repository name in the snapshot info. Defaults to true.
438
+ * @param {boolean} [params.verbose] - Whether to show verbose snapshot info or only show the basic info found in the repository index blob
439
+ *
440
+ * @param {Object} options - Options for {@link Transport#request}
441
+ * @param {function} callback - Callback that handles errors and response
442
+ *
443
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
444
+ */
325
445
  SnapshotApi.prototype.get = function snapshotGetApi(params, options, callback) {
326
446
  [params, options, callback] = normalizeArguments(params, options, callback);
327
447
 
@@ -360,6 +480,21 @@ SnapshotApi.prototype.get = function snapshotGetApi(params, options, callback) {
360
480
  return this.transport.request(request, options, callback);
361
481
  };
362
482
 
483
+ /**
484
+ * Returns information about a snapshot.
485
+ *
486
+ * @memberOf API-Snapshot
487
+ *
488
+ * @param {Object} params
489
+ * @param {string} [params.repository] - A comma-separated list of repository names
490
+ * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to cluster_manager node
491
+ * @param {boolean} [params.local] - Return local information, do not retrieve the state from cluster_manager node (default: false)
492
+ *
493
+ * @param {Object} options - Options for {@link Transport#request}
494
+ * @param {function} callback - Callback that handles errors and response
495
+ *
496
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
497
+ */
363
498
  SnapshotApi.prototype.getRepository = function snapshotGetRepositoryApi(params, options, callback) {
364
499
  [params, options, callback] = normalizeArguments(params, options, callback);
365
500
 
@@ -386,6 +521,30 @@ SnapshotApi.prototype.getRepository = function snapshotGetRepositoryApi(params,
386
521
  return this.transport.request(request, options, callback);
387
522
  };
388
523
 
524
+ /**
525
+ * Analyzes a repository for correctness and performance
526
+ *
527
+ * @memberOf API-Snapshot
528
+ *
529
+ * @param {Object} params
530
+ * @param {string} [params.repository] - A repository name
531
+ * @param {number} [params.blob_count] - Number of blobs to create during the test. Defaults to 100.
532
+ * @param {number} [params.concurrency] - Number of operations to run concurrently during the test. Defaults to 10.
533
+ * @param {number} [params.read_node_count] - Number of nodes on which to read a blob after writing. Defaults to 10.
534
+ * @param {number} [params.early_read_node_count] - Number of nodes on which to perform an early read on a blob, i.e. before writing has completed. Early reads are rare actions so the 'rare_action_probability' parameter is also relevant. Defaults to 2.
535
+ * @param {number} [params.seed] - Seed for the random number generator used to create the test workload. Defaults to a random value.
536
+ * @param {number} [params.rare_action_probability] - Probability of taking a rare action such as an early read or an overwrite. Defaults to 0.02.
537
+ * @param {string} [params.max_blob_size] - Maximum size of a blob to create during the test, e.g '1gb' or '100mb'. Defaults to '10mb'.
538
+ * @param {string} [params.max_total_data_size] - Maximum total size of all blobs to create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'.
539
+ * @param {string} [params.timeout] - Explicit operation timeout. Defaults to '30s'.
540
+ * @param {boolean} [params.detailed] - Whether to return detailed results or a summary. Defaults to 'false' so that only the summary is returned.
541
+ * @param {boolean} [params.rarely_abort_writes] - Whether to rarely abort writes before they complete. Defaults to 'true'.
542
+ *
543
+ * @param {Object} options - Options for {@link Transport#request}
544
+ * @param {function} callback - Callback that handles errors and response
545
+ *
546
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
547
+ */
389
548
  SnapshotApi.prototype.repositoryAnalyze = function snapshotRepositoryAnalyzeApi(
390
549
  params,
391
550
  options,
@@ -417,6 +576,24 @@ SnapshotApi.prototype.repositoryAnalyze = function snapshotRepositoryAnalyzeApi(
417
576
  return this.transport.request(request, options, callback);
418
577
  };
419
578
 
579
+ /**
580
+ * Restores a snapshot.
581
+ *
582
+ * @memberOf API-Snapshot
583
+ *
584
+ * @param {Object} params
585
+ * @param {string} [params.repository] - A repository name
586
+ * @param {string} [params.snapshot] - A snapshot name
587
+ * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
588
+ * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node
589
+ * @param {boolean} [params.wait_for_completion] - Should this request wait until the operation has completed before returning
590
+ * @param {Object} [params.body] - Details of what to restore
591
+ *
592
+ * @param {Object} options - Options for {@link Transport#request}
593
+ * @param {function} callback - Callback that handles errors and response
594
+ *
595
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
596
+ */
420
597
  SnapshotApi.prototype.restore = function snapshotRestoreApi(params, options, callback) {
421
598
  [params, options, callback] = normalizeArguments(params, options, callback);
422
599
 
@@ -462,6 +639,23 @@ SnapshotApi.prototype.restore = function snapshotRestoreApi(params, options, cal
462
639
  return this.transport.request(request, options, callback);
463
640
  };
464
641
 
642
+ /**
643
+ * Returns information about the status of a snapshot.
644
+ *
645
+ * @memberOf API-Snapshot
646
+ *
647
+ * @param {Object} params
648
+ * @param {string} [params.repository] - A repository name
649
+ * @param {string} [params.snapshot] - A comma-separated list of snapshot names
650
+ * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
651
+ * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node
652
+ * @param {boolean} [params.ignore_unavailable] - Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown
653
+ *
654
+ * @param {Object} options - Options for {@link Transport#request}
655
+ * @param {function} callback - Callback that handles errors and response
656
+ *
657
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
658
+ */
465
659
  SnapshotApi.prototype.status = function snapshotStatusApi(params, options, callback) {
466
660
  [params, options, callback] = normalizeArguments(params, options, callback);
467
661
 
@@ -505,6 +699,22 @@ SnapshotApi.prototype.status = function snapshotStatusApi(params, options, callb
505
699
  return this.transport.request(request, options, callback);
506
700
  };
507
701
 
702
+ /**
703
+ * Verifies a repository.
704
+ *
705
+ * @memberOf API-Snapshot
706
+ *
707
+ * @param {Object} params
708
+ * @param {string} [params.repository] - A repository name
709
+ * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
710
+ * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node
711
+ * @param {string} [params.timeout] - Explicit operation timeout
712
+ *
713
+ * @param {Object} options - Options for {@link Transport#request}
714
+ * @param {function} callback - Callback that handles errors and response
715
+ *
716
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
717
+ */
508
718
  SnapshotApi.prototype.verifyRepository = function snapshotVerifyRepositoryApi(
509
719
  params,
510
720
  options,
package/api/api/tasks.js CHANGED
@@ -32,6 +32,8 @@
32
32
  /* eslint camelcase: 0 */
33
33
  /* eslint no-unused-vars: 0 */
34
34
 
35
+ /** @namespace API-Tasks */
36
+
35
37
  const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
38
  const acceptedQuerystring = [
37
39
  'nodes',
@@ -60,6 +62,24 @@ function TasksApi(transport, ConfigurationError) {
60
62
  this[kConfigurationError] = ConfigurationError;
61
63
  }
62
64
 
65
+ /**
66
+ * Cancels a task, if it can be cancelled through an API.
67
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/tasks/#task-canceling OpenSearch - Task Cancelling}
68
+ *
69
+ * @memberOf API-Tasks
70
+ *
71
+ * @param {Object} params
72
+ * @param {string} [params.task_id] - Cancel the task with specified task id (node_id:task_number)
73
+ * @param {string} [params.nodes] - 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
74
+ * @param {string} [params.actions] - A comma-separated list of actions that should be cancelled. Leave empty to cancel all.
75
+ * @param {string} [params.parent_task_id] - Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all.
76
+ * @param {boolean} [params.wait_for_completion] - Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false
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>|*}
82
+ */
63
83
  TasksApi.prototype.cancel = function tasksCancelApi(params, options, callback) {
64
84
  [params, options, callback] = normalizeArguments(params, options, callback);
65
85
 
@@ -86,6 +106,22 @@ TasksApi.prototype.cancel = function tasksCancelApi(params, options, callback) {
86
106
  return this.transport.request(request, options, callback);
87
107
  };
88
108
 
109
+ /**
110
+ * Returns information about a task.
111
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/tasks OpenSearch - Tasks}
112
+ *
113
+ * @memberOf API-Tasks
114
+ *
115
+ * @param {Object} params
116
+ * @param {string} [params.task_id] - Return the task with specified id (node_id:task_number)
117
+ * @param {boolean} [params.wait_for_completion] - Wait for the matching tasks to complete (default: false)
118
+ * @param {string} [params.timeout] - Explicit operation timeoutompletion] - Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false
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>|*}
124
+ */
89
125
  TasksApi.prototype.get = function tasksGetApi(params, options, callback) {
90
126
  [params, options, callback] = normalizeArguments(params, options, callback);
91
127
 
@@ -113,6 +149,26 @@ TasksApi.prototype.get = function tasksGetApi(params, options, callback) {
113
149
  return this.transport.request(request, options, callback);
114
150
  };
115
151
 
152
+ /**
153
+ * Returns a list of tasks.
154
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/tasks OpenSearch - Tasks}
155
+ *
156
+ * @memberOf API-Tasks
157
+ *
158
+ * @param {Object} params
159
+ * @param {string} [params.nodes] - 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
160
+ * @param {string} [params.actions] - A comma-separated list of actions that should be returned. Leave empty to return all.
161
+ * @param {boolean} [params.detailed] - Return detailed task information (default: false)
162
+ * @param {string} [params.parent_task_id] - Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all.
163
+ * @param {boolean} [params.wait_for_completion] - Wait for the matching tasks to complete (default: false)
164
+ * @param {string} [params.group_by] - Group tasks by nodes or parent/child relationships (options: nodes, parents, none)
165
+ * @param {string} [params.timeout] - Explicit operation timeout
166
+ *
167
+ * @param {Object} options - Options for {@link Transport#request}
168
+ * @param {function} callback - Callback that handles errors and response
169
+ *
170
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
171
+ */
116
172
  TasksApi.prototype.list = function tasksListApi(params, options, callback) {
117
173
  [params, options, callback] = normalizeArguments(params, options, callback);
118
174
 
@@ -36,6 +36,7 @@ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } =
36
36
  const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path'];
37
37
  const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' };
38
38
 
39
+ // TODO: Remove. Added in ES 7.14
39
40
  function termsEnumApi(params, options, callback) {
40
41
  [params, options, callback] = normalizeArguments(params, options, callback);
41
42
 
@@ -59,6 +59,32 @@ const snakeCase = {
59
59
  filterPath: 'filter_path',
60
60
  };
61
61
 
62
+ /**
63
+ * Returns information and statistics about terms in the fields of a particular document.
64
+ *
65
+ * @memberOf API-Document
66
+ *
67
+ * @param {Object} params
68
+ * @param {string} params.index - The index in which the document resides.
69
+ * @param {string} [params.id] - The id of the document, when not specified a doc param should be supplied.
70
+ * @param {boolean} [params.term_statistics] - Specifies if total term frequency and document frequency should be returned.
71
+ * @param {boolean} [params.field_statistics] - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.
72
+ * @param {string} [params.fields] - A comma-separated list of fields to return.
73
+ * @param {boolean} [params.offsets] - Specifies if term offsets should be returned.
74
+ * @param {boolean} [params.positions] - Specifies if term positions should be returned.
75
+ * @param {boolean} [params.payloads] - Specifies if term payloads should be returned.
76
+ * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random).
77
+ * @param {string} [params.routing] - Specific routing value.
78
+ * @param {boolean} [params.realtime] - Specifies if request is real-time as opposed to near-real-time (default: true).
79
+ * @param {number} [params.version] - Explicit version number for concurrency control
80
+ * @param {string} [params.version_type] - Specific version type (options: internal, external, external_gte, force)
81
+ * @param {Object} [params.body] - Define parameters and or supply a document to get termvectors for. See documentation.
82
+ *
83
+ * @param {Object} options - Options for {@link Transport#request}
84
+ * @param {function} callback - Callback that handles errors and response
85
+ *
86
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
87
+ */
62
88
  function termvectorsApi(params, options, callback) {
63
89
  [params, options, callback] = normalizeArguments(params, options, callback);
64
90
 
package/api/api/update.js CHANGED
@@ -68,6 +68,34 @@ const snakeCase = {
68
68
  filterPath: 'filter_path',
69
69
  };
70
70
 
71
+ /**
72
+ * Update an existing document
73
+ * <br/> See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/update-document/ OpenSearch - Update Document}
74
+ *
75
+ * @memberOf API-Document
76
+ *
77
+ * @param {Object} params
78
+ * @param {string} params.index - Name of the index.
79
+ * @param {string} params.id - A unique identifier to attach to the document.
80
+ * @param {Object} params.body - The request definition requires either `script` or partial `doc`.
81
+ * @param {number} [params.if_seq_no] - Only perform the update operation if the document has the specified sequence number.
82
+ * @param {number} [params.if_primary_term] - Only perform the update operation if the document has the specified primary term.
83
+ * @param {string} [params.lang=painless] - Language of the script.
84
+ * @param {string} [params.routing] - Value used to assign the index operation to a specific shard.
85
+ * @param {string} [params._source=true] - Whether to include the '_source' field in the response body.
86
+ * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response.
87
+ * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response.
88
+ * @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.
89
+ * @param {number} [params.retry_on_conflict=0] - The amount of times OpenSearch should retry the operation if there’s a document conflict.
90
+ * @param {string} [params.timeout=1m] - How long to wait for a response from the cluster.
91
+ * @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.
92
+ * @param {boolean} [params.require_alias=false] - Specifies whether the target index must be an index alias.
93
+ *
94
+ * @param {Object} options - Options for {@link Transport#request}
95
+ * @param {function} callback - Callback that handles errors and response
96
+ *
97
+ * @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}
98
+ */
71
99
  function updateApi(params, options, callback) {
72
100
  [params, options, callback] = normalizeArguments(params, options, callback);
73
101
 
@@ -101,6 +101,56 @@ const snakeCase = {
101
101
  filterPath: 'filter_path',
102
102
  };
103
103
 
104
+ /**
105
+ * Run a script to update all documents that match the query.
106
+ * <br/> See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/update-by-query/ OpenSearch - Update by query}
107
+ *
108
+ * @memberOf API-Document
109
+ *
110
+ * @param {Object} params
111
+ * @param {string} params.index - A comma-separated list of index names to search; use '_all' or empty string to perform the operation on all indices
112
+ * @param {Object} [params.body] - The search definition using the Query DSL
113
+ * @param {string} [params.analyzer] - The analyzer to use for the query string
114
+ * @param {boolean} [params.analyze_wildcard=false] - Specify whether wildcard and prefix queries should be analyzed (default: false)
115
+ * @param {string} [params.default_operator=OR] - The default operator for query string query (options: AND, OR)
116
+ * @param {string} [params.df] - The field to use as default where no field prefix is given in the query string
117
+ * @param {number} [params.from=0] - Starting offset
118
+ * @param {boolean} [params.ignore_unavailable=false] - Whether specified concrete indices should be ignored when unavailable (missing or closed)
119
+ * @param {boolean} [params.allow_no_indices=true] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes '_all' string or when no indices have been specified)
120
+ * @param {string} [params.conflicts=abort] - What to do when the update by query hits version conflicts? (options: abort, proceed)
121
+ * @param {string} [params.expand_wildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
122
+ * @param {boolean} [params.lenient=false] - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
123
+ * @param {string} [params.pipeline] - Ingest pipeline to set on index requests made by this action. (default: none)
124
+ * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random)
125
+ * @param {string} [params.q] - Query in the Lucene query string syntax
126
+ * @param {string} [params.routing] - A comma-separated list of specific routing values
127
+ * @param {string} [params.scroll] - Specify how long a consistent view of the index should be maintained for scrolled search
128
+ * @param {string} [params.search_type=query_then_fetch] - Search operation type (options: query_then_fetch, dfs_query_then_fetch)
129
+ * @param {string} [params.search_timeout] - Explicit timeout for each search request. Defaults to no timeout.
130
+ * @param {number} [params.size] - Deprecated, please use 'max_docs' instead
131
+ * @param {number} [params.max_docs] - Maximum number of documents to process (default: all documents)
132
+ * @param {string} [params.sort] - A comma-separated list of <field>:<direction> pairs
133
+ * @param {string} [params._source] - True or false to return the _source field or not, or a list of fields to return
134
+ * @param {string} [params._source_excludes] - A list of fields to exclude from the returned _source field
135
+ * @param {string} [params._source_includes] - A list of fields to extract and return from the _source field
136
+ * @param {number} [params.terminate_after] - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
137
+ * @param {string} [params.stats] - Specific 'tag' of the request for logging and statistical purposes
138
+ * @param {boolean} [params.version] - Specify whether to return document version as part of a hit
139
+ * @param {boolean} [params.version_type] - Should the document increment the version number (internal) on hit or not (reindex)
140
+ * @param {boolean} [params.request_cache] - Specify if request cache should be used for this request or not, defaults to index level setting
141
+ * @param {boolean} [params.refresh=false] - Should the affected indexes be refreshed?
142
+ * @param {string} [params.timeout] - Time each individual bulk request should wait for shards that are unavailable.
143
+ * @param {string} [params.wait_for_active_shards=1] - Sets the number of shard copies that must be active before proceeding with the update by query operation. 1 means the primary shard only. Set to 'all' for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
144
+ * @param {number} [params.scroll_size=1000] - Size on the scroll request powering the update by query
145
+ * @param {boolean} [params.wait_for_completion=true] - Should the request should block until the update by query operation is complete.
146
+ * @param {number} [params.requests_per_second=-1] - The throttle to set on this request in sub-requests per second. -1 means no throttle.
147
+ * @param {string} [params.slices=1] - The number of slices this task should be divided into. 1 means the task isn't sliced into subtasks. Can be set to 'auto'.
148
+ *
149
+ * @param {Object} options - Options for {@link Transport#request}
150
+ * @param {function} callback - Callback that handles errors and response
151
+ *
152
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/update-by-query/#response Update by query Response}
153
+ */
104
154
  function updateByQueryApi(params, options, callback) {
105
155
  [params, options, callback] = normalizeArguments(params, options, callback);
106
156
 
@@ -47,6 +47,20 @@ const snakeCase = {
47
47
  filterPath: 'filter_path',
48
48
  };
49
49
 
50
+ /**
51
+ * Changes the number of requests per second for a particular Update By Query operation.
52
+ *
53
+ * @memberOf API-Document
54
+ *
55
+ * @param {Object} params
56
+ * @param {string} params.task_id - The task id to rethrottle
57
+ * @param {number} params.requests_per_second - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
58
+ *
59
+ * @param {Object} options - Options for {@link Transport#request}
60
+ * @param {function} callback - Callback that handles errors and response
61
+ *
62
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
63
+ */
50
64
  function updateByQueryRethrottleApi(params, options, callback) {
51
65
  [params, options, callback] = normalizeArguments(params, options, callback);
52
66