@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
package/api/api/delete.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
  /*
@@ -58,6 +57,29 @@ const snakeCase = {
58
57
  filterPath: 'filter_path',
59
58
  };
60
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
+ */
61
83
  function deleteApi(params, options, callback) {
62
84
  [params, options, callback] = normalizeArguments(params, options, callback);
63
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;
@@ -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
  /*
@@ -99,6 +98,54 @@ const snakeCase = {
99
98
  filterPath: 'filter_path',
100
99
  };
101
100
 
101
+ /**
102
+ * Deletes documents matching the provided query.
103
+ * <br/> See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/delete-by-query/ OpenSearch - Delete by query}
104
+ *
105
+ * @memberOf API-Document
106
+ *
107
+ * @param {Object} params
108
+ * @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
109
+ * @param {Object} params.body - The search definition using the Query DSL
110
+ * @param {string} [params.analyzer] - The analyzer to use for the query string
111
+ * @param {boolean} [params.analyze_wildcard=false] - Specify whether wildcard and prefix queries should be analyzed
112
+ * @param {string} [params.default_operator=OR] - The default operator for query string query (options: AND, OR)
113
+ * @param {string} [params.df] - The field to use as default where no field prefix is given in the query string
114
+ * @param {number} [params.from=0] - Starting offset
115
+ * @param {boolean} [params.ignore_unavailable=false] - Whether specified concrete indices should be ignored when unavailable (missing or closed)
116
+ * @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)
117
+ * @param {string} [params.conflicts] - What to do when the delete-by-query hits version conflicts? (options: abort, proceed)
118
+ * @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)
119
+ * @param {boolean} [params.lenient=false] - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
120
+ * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random)
121
+ * @param {string} [params.q] - Query in the Lucene query string syntax
122
+ * @param {string} [params.routing] - A comma-separated list of specific routing values
123
+ * @param {string} [params.scroll] - Specify how long a consistent view of the index should be maintained for scrolled search
124
+ * @param {string} [params.search_type] - Search operation type (options: query_then_fetch, dfs_query_then_fetch)
125
+ * @param {string} [params.search_timeout] - Explicit timeout for each search request. Defaults to no timeout.
126
+ * @param {number} [params.size] - Deprecated, please use 'max_docs' instead
127
+ * @param {number} [params.max_docs] - Maximum number of documents to process (default: all documents)
128
+ * @param {string} [params.sort] - A comma-separated list of <field>:<direction> pairs
129
+ * @param {string} [params._source] - True or false to return the _source field or not, or a list of fields to return
130
+ * @param {string} [params._source_excludes] - A list of fields to exclude from the returned _source field
131
+ * @param {string} [params._source_includes] - A list of fields to extract and return from the _source field
132
+ * @param {number} [params.terminate_after] - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
133
+ * @param {string} [params.stats] - Specific 'tag' of the request for logging and statistical purposes
134
+ * @param {boolean} [params.version] - Specify whether to return document version as part of a hit
135
+ * @param {boolean} [params.request_cache] - Specify if request cache should be used for this request or not, defaults to index level setting
136
+ * @param {boolean} [params.refresh=false] - Should the effected indexes be refreshed?
137
+ * @param {string} [params.timeout=1m] - time each individual bulk request should wait for shards that are unavailable.
138
+ * @param {string} [params.wait_for_active_shards=1] - Sets the number of shard copies that must be active before proceeding with the delete-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)
139
+ * @param {number} [params.scroll_size=1000] - Size on the scroll request powering the delete-by-query
140
+ * @param {boolean} [params.wait_for_completion] - Should the request should block until the delete-by-query is complete.
141
+ * @param {number} [params.requests_per_second=-1] - The throttle for this request in sub-requests per second. -1 means no throttle.
142
+ * @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'.
143
+ *
144
+ * @param {Object} options - Options for {@link Transport#request}
145
+ * @param {function} callback - Callback that handles errors and response
146
+ *
147
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/delete-by-query/#response Delete by query Response}
148
+ */
102
149
  function deleteByQueryApi(params, options, callback) {
103
150
  [params, options, callback] = normalizeArguments(params, options, callback);
104
151
 
@@ -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
  /*
@@ -48,6 +47,20 @@ const snakeCase = {
48
47
  filterPath: 'filter_path',
49
48
  };
50
49
 
50
+ /**
51
+ * Changes the number of requests per second for a particular Delete 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
+ */
51
64
  function deleteByQueryRethrottleApi(params, options, callback) {
52
65
  [params, options, callback] = normalizeArguments(params, options, callback);
53
66
 
@@ -0,0 +1,61 @@
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 one or several PITs. PITs are automatically deleted when the keep_alive time period elapses. However, to deallocate resources, you can delete a PIT using the Delete PIT API.
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
+ * @param {Object} params.body
27
+ * @param {string[]} params.body.pit_id - The PIT IDs of the PITs to be deleted.
28
+ *
29
+ * @param {Object} [options] - Options for {@link Transport#request}
30
+ * @param {function} [callback] - Callback that handles errors and response
31
+ *
32
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#sample-response-2|Delete PIT Response}
33
+ */
34
+ function deletePitApi(params, options, callback) {
35
+ [params, options, callback] = normalizeArguments(params, options, callback);
36
+
37
+ // check required parameters
38
+ if (params['body'] == null) {
39
+ const err = new this[kConfigurationError]('Missing required parameter: body');
40
+ return handleError(err, callback);
41
+ }
42
+
43
+ let { method, body, ...querystring } = params;
44
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
45
+
46
+ let path = '';
47
+ if (method == null) method = 'DELETE';
48
+ path = '/' + '_search' + '/' + 'point_in_time';
49
+
50
+ // build request object
51
+ const request = {
52
+ method,
53
+ path,
54
+ body: body || '',
55
+ querystring,
56
+ };
57
+
58
+ return this.transport.request(request, options, callback);
59
+ }
60
+
61
+ module.exports = deletePitApi;
@@ -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
  /*
@@ -51,6 +50,20 @@ const snakeCase = {
51
50
  filterPath: 'filter_path',
52
51
  };
53
52
 
53
+ /**
54
+ * Delete a stored script.
55
+ * @memberOf API-Script
56
+ *
57
+ * @param {Object} params
58
+ * @param {string} params.id - Stored script or search template name
59
+ * @param {string} [params.timeout=30s] - Explicit operation timeout
60
+ * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager
61
+ *
62
+ * @param {Object} [options] - Options for {@link Transport#request}
63
+ * @param {function} [callback] - Callback that handles errors and response
64
+ *
65
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
66
+ */
54
67
  function deleteScriptApi(params, options, callback) {
55
68
  [params, options, callback] = normalizeArguments(params, options, callback);
56
69
 
package/api/api/exists.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
  /*
@@ -64,6 +63,31 @@ const snakeCase = {
64
63
  filterPath: 'filter_path',
65
64
  };
66
65
 
66
+ /**
67
+ * Check whether a document exists
68
+ * <br/> See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/ OpenSearch - Get Document}
69
+ *
70
+ * @memberOf API-Document
71
+ *
72
+ * @param {Object} params
73
+ * @param {string} params.index - Name of the index.
74
+ * @param {string} params.id - Document ID.
75
+ * @param {string} [params.preference] - Specifies a preference of which shard to retrieve results from. Available options are '_local', which tells the operation to retrieve results from a locally allocated shard replica, and a custom string value assigned to a specific shard replica. By default, OpenSearch executes get document operations on random shards.
76
+ * @param {boolean} [params.realtime=true] - Specifies whether the operation should run in realtime. If false, the operation waits for the index to refresh to analyze the source to retrieve data, which makes the operation near-realtime.
77
+ * @param {boolean} [params.refresh=false] - If true, OpenSearch refreshes shards to make the get operation available to search results. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation.
78
+ * @param {string} [params.routing] - A value used to route the operation to a specific shard.
79
+ * @param {boolean} [params.stored_fields=false] - Whether the get operation should retrieve fields stored in the index.
80
+ * @param {string} [params._source=true] - Whether to include the '_source' field in the response body.
81
+ * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response.
82
+ * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response.
83
+ * @param {number} [params.version] - The document’s version number.
84
+ * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte')
85
+ *
86
+ * @param {Object} options - Options for {@link Transport#request}
87
+ * @param {function} callback - Callback that handles errors and response
88
+ *
89
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/#response Get Response}
90
+ */
67
91
  function existsApi(params, options, callback) {
68
92
  [params, options, callback] = normalizeArguments(params, options, callback);
69
93
 
@@ -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,31 @@
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
35
+ /**
36
+ * Check whether a document source exists
37
+ * <br/> See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/ OpenSearch - Get Document}
38
+ *
39
+ * @memberOf API-Document
40
+ *
41
+ * @param {Object} params
42
+ * @param {string} params.index - Name of the index.
43
+ * @param {string} params.id - Document ID.
44
+ * @param {string} [params.preference] - Specifies a preference of which shard to retrieve results from. Available options are '_local', which tells the operation to retrieve results from a locally allocated shard replica, and a custom string value assigned to a specific shard replica. By default, OpenSearch executes get document operations on random shards.
45
+ * @param {boolean} [params.realtime=true] - Specifies whether the operation should run in realtime. If false, the operation waits for the index to refresh to analyze the source to retrieve data, which makes the operation near-realtime.
46
+ * @param {boolean} [params.refresh=false] - If true, OpenSearch refreshes shards to make the get operation available to search results. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation.
47
+ * @param {string} [params.routing] - A value used to route the operation to a specific shard.
48
+ * @param {boolean} [params.stored_fields=false] - Whether the get operation should retrieve fields stored in the index.
49
+ * @param {string} [params._source=true] - Whether to include the '_source' field in the response body.
50
+ * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response.
51
+ * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response.
52
+ * @param {number} [params.version] - The document’s version number.
53
+ * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte')
54
+ *
55
+ * @param {Object} options - Options for {@link Transport#request}
56
+ * @param {function} callback - Callback that handles errors and response
57
+ *
58
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/#response Get Response}
59
+ */
36
60
  const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
37
61
  const acceptedQuerystring = [
38
62
  'preference',
@@ -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
  /*
@@ -67,6 +66,33 @@ const snakeCase = {
67
66
  filterPath: 'filter_path',
68
67
  };
69
68
 
69
+ /**
70
+ * Returns information about why a specific matches (or doesn't match) a query.
71
+ * <br/> See also: {@link https://opensearch.org/docs/latest/api-reference/explain/ OpenSearch - Explain}
72
+ * @memberOf API-Search
73
+ *
74
+ * @param {Object} params
75
+ * @param {string} [params.id] - The document ID
76
+ * @param {string} [params.index] - The name of the index
77
+ * @param {Object} [params.body] - The query definition using the Query DSL
78
+ * @param {string} [params.analyzer] - The analyzer to use for the query string
79
+ * @param {boolean} [params.analyze_wildcard=false] - Specify whether wildcard and prefix queries should be analyzed
80
+ * @param {string} [params.default_operator=OR] - The default operator for query string query (options: AND, OR)
81
+ * @param {string} [params.df] - The default field for query string query (default: _all)
82
+ * @param {string} [params.stored_fields] - A comma-separated list of stored fields to return in the response
83
+ * @param {boolean} [params.lenient] - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
84
+ * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random)
85
+ * @param {string} [params.q] - Query in the Lucene query string syntax
86
+ * @param {string} [params.routing] - Specific routing value
87
+ * @param {string} [params._source=true] - Whether to include the '_source' field in the response body.
88
+ * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response.
89
+ * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response.
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
+ */
70
96
  function explainApi(params, options, callback) {
71
97
  [params, options, callback] = normalizeArguments(params, options, callback);
72
98
 
@@ -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-Features */
36
+
36
37
  const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
37
38
  const acceptedQuerystring = [
38
39
  'cluster_manager_timeout',
@@ -55,6 +56,18 @@ function FeaturesApi(transport, ConfigurationError) {
55
56
  this[kConfigurationError] = ConfigurationError;
56
57
  }
57
58
 
59
+ /**
60
+ * Gets a list of features
61
+ * @memberOf API-Features
62
+ *
63
+ * @param {Object} params
64
+ * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node
65
+ *
66
+ * @param {Object} [options] - Options for {@link Transport#request}
67
+ * @param {function} [callback] - Callback that handles errors and response
68
+ *
69
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
70
+ */
58
71
  FeaturesApi.prototype.getFeatures = function featuresGetFeaturesApi(params, options, callback) {
59
72
  [params, options, callback] = normalizeArguments(params, options, callback);
60
73
 
@@ -76,6 +89,16 @@ FeaturesApi.prototype.getFeatures = function featuresGetFeaturesApi(params, opti
76
89
  return this.transport.request(request, options, callback);
77
90
  };
78
91
 
92
+ /**
93
+ * Resets the internal state of features, usually by deleting system indices
94
+ * @memberOf API-Features
95
+ *
96
+ * @param {Object} params - (Unused)
97
+ * @param {Object} [options] - Options for {@link Transport#request}
98
+ * @param {function} [callback] - Callback that handles errors and response
99
+ *
100
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
101
+ */
79
102
  FeaturesApi.prototype.resetFeatures = function featuresResetFeaturesApi(params, options, callback) {
80
103
  [params, options, callback] = normalizeArguments(params, options, callback);
81
104
 
@@ -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,25 @@ const snakeCase = {
55
54
  filterPath: 'filter_path',
56
55
  };
57
56
 
57
+ /**
58
+ * Returns the information about the capabilities of fields among multiple indices.
59
+ * <br/> See also: {@link https://opensearch.org/docs/latest/opensearch/supported-field-types/alias/#using-aliases-in-field-capabilities-api-operations OpenSearch - Alias}
60
+ * @memberOf API-Index
61
+ *
62
+ * @param {Object} params
63
+ * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
64
+ * @param {string} [params.fields] - A comma-separated list of field names
65
+ * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed)
66
+ * @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)
67
+ * @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)
68
+ * @param {boolean} [params.include_unmapped] - Indicates whether unmapped fields should be included in the response.
69
+ * @param {Object} [params.body] - An index filter specified with the Query DSL
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
+ */
58
76
  function fieldCapsApi(params, options, callback) {
59
77
  [params, options, callback] = normalizeArguments(params, options, callback);
60
78
 
package/api/api/get.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
  /*
@@ -64,6 +63,31 @@ const snakeCase = {
64
63
  filterPath: 'filter_path',
65
64
  };
66
65
 
66
+ /**
67
+ * Retrieve a document
68
+ * <br/> See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/ OpenSearch - Get Document}
69
+ *
70
+ * @memberOf API-Document
71
+ *
72
+ * @param {Object} params
73
+ * @param {string} params.index - Name of the index.
74
+ * @param {string} params.id - Document ID.
75
+ * @param {string} [params.preference] - Specifies a preference of which shard to retrieve results from. Available options are '_local', which tells the operation to retrieve results from a locally allocated shard replica, and a custom string value assigned to a specific shard replica. By default, OpenSearch executes get document operations on random shards.
76
+ * @param {boolean} [params.realtime=true] - Specifies whether the operation should run in realtime. If false, the operation waits for the index to refresh to analyze the source to retrieve data, which makes the operation near-realtime.
77
+ * @param {boolean} [params.refresh=false] - If true, OpenSearch refreshes shards to make the get operation available to search results. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation.
78
+ * @param {string} [params.routing] - A value used to route the operation to a specific shard.
79
+ * @param {boolean} [params.stored_fields=false] - Whether the get operation should retrieve fields stored in the index.
80
+ * @param {string} [params._source=true] - Whether to include the '_source' field in the response body.
81
+ * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response.
82
+ * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response.
83
+ * @param {number} [params.version] - The document’s version number.
84
+ * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte')
85
+ *
86
+ * @param {Object} options - Options for {@link Transport#request}
87
+ * @param {function} callback - Callback that handles errors and response
88
+ *
89
+ * @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/#response Get Response}
90
+ */
67
91
  function getApi(params, options, callback) {
68
92
  [params, options, callback] = normalizeArguments(params, options, callback);
69
93
 
@@ -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
+ * Returns all PITs in the OpenSearch cluster.
22
+ * <br/> See Also: {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#list-all-pits|Opensearch - List all 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-1|List all PITs Response}
31
+ */
32
+ function getAllPitsApi(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 = 'GET';
40
+ path = '/' + '_search' + '/' + 'point_in_time' + '/' + '_all';
41
+
42
+ // build request object
43
+ const request = {
44
+ method,
45
+ path,
46
+ body: null,
47
+ querystring,
48
+ };
49
+
50
+ return this.transport.request(request, options, callback);
51
+ }
52
+
53
+ module.exports = getAllPitsApi;