@opensearch-project/opensearch 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/.dockerignore +5 -0
  2. package/ADMINS.md +34 -0
  3. package/DEVELOPER_GUIDE.md +60 -0
  4. package/LICENSE.txt +201 -0
  5. package/MAINTAINERS.md +73 -0
  6. package/Makefile +27 -0
  7. package/NOTICE.txt +8 -0
  8. package/README.md +183 -0
  9. package/RELEASING.md +34 -0
  10. package/SECURITY.md +3 -0
  11. package/api/api/bulk.js +81 -0
  12. package/api/api/cat.js +525 -0
  13. package/api/api/clear_scroll.js +66 -0
  14. package/api/api/cluster.js +431 -0
  15. package/api/api/count.js +75 -0
  16. package/api/api/create.js +80 -0
  17. package/api/api/dangling_indices.js +126 -0
  18. package/api/api/delete.js +76 -0
  19. package/api/api/delete_by_query.js +82 -0
  20. package/api/api/delete_by_query_rethrottle.js +71 -0
  21. package/api/api/delete_script.js +67 -0
  22. package/api/api/exists.js +76 -0
  23. package/api/api/exists_source.js +85 -0
  24. package/api/api/explain.js +76 -0
  25. package/api/api/features.js +92 -0
  26. package/api/api/field_caps.js +66 -0
  27. package/api/api/get.js +76 -0
  28. package/api/api/get_script.js +67 -0
  29. package/api/api/get_script_context.js +61 -0
  30. package/api/api/get_script_languages.js +61 -0
  31. package/api/api/get_source.js +76 -0
  32. package/api/api/index.js +82 -0
  33. package/api/api/indices.js +1516 -0
  34. package/api/api/info.js +61 -0
  35. package/api/api/ingest.js +211 -0
  36. package/api/api/mget.js +81 -0
  37. package/api/api/msearch.js +81 -0
  38. package/api/api/msearch_template.js +81 -0
  39. package/api/api/mtermvectors.js +75 -0
  40. package/api/api/nodes.js +279 -0
  41. package/api/api/ping.js +61 -0
  42. package/api/api/put_script.js +82 -0
  43. package/api/api/rank_eval.js +72 -0
  44. package/api/api/reindex.js +67 -0
  45. package/api/api/reindex_rethrottle.js +71 -0
  46. package/api/api/render_search_template.js +66 -0
  47. package/api/api/scripts_painless_execute.js +61 -0
  48. package/api/api/scroll.js +66 -0
  49. package/api/api/search.js +75 -0
  50. package/api/api/search_shards.js +66 -0
  51. package/api/api/search_template.js +81 -0
  52. package/api/api/shutdown.js +135 -0
  53. package/api/api/snapshot.js +450 -0
  54. package/api/api/tasks.js +119 -0
  55. package/api/api/terms_enum.js +67 -0
  56. package/api/api/termvectors.js +78 -0
  57. package/api/api/update.js +80 -0
  58. package/api/api/update_by_query.js +78 -0
  59. package/api/api/update_by_query_rethrottle.js +71 -0
  60. package/api/index.js +254 -0
  61. package/api/new.d.ts +716 -0
  62. package/api/requestParams.d.ts +1583 -0
  63. package/api/types.d.ts +9481 -0
  64. package/api/utils.js +69 -0
  65. package/codecov.yml +14 -0
  66. package/index.d.ts +1210 -0
  67. package/index.js +338 -0
  68. package/index.mjs +40 -0
  69. package/lib/Connection.d.ts +107 -0
  70. package/lib/Connection.js +345 -0
  71. package/lib/Helpers.d.ts +135 -0
  72. package/lib/Helpers.js +779 -0
  73. package/lib/Serializer.d.ts +41 -0
  74. package/lib/Serializer.js +105 -0
  75. package/lib/Transport.d.ts +173 -0
  76. package/lib/Transport.js +646 -0
  77. package/lib/errors.d.ts +101 -0
  78. package/lib/errors.js +168 -0
  79. package/lib/pool/BaseConnectionPool.js +269 -0
  80. package/lib/pool/CloudConnectionPool.js +75 -0
  81. package/lib/pool/ConnectionPool.js +257 -0
  82. package/lib/pool/index.d.ts +215 -0
  83. package/lib/pool/index.js +41 -0
  84. package/package.json +102 -0
@@ -0,0 +1,279 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'interval', 'snapshots', 'threads', 'ignore_idle_threads', 'type', 'timeout', 'flat_settings', 'completion_fields', 'fielddata_fields', 'fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments']
38
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', ignoreIdleThreads: 'ignore_idle_threads', flatSettings: 'flat_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments' }
39
+
40
+ function NodesApi (transport, ConfigurationError) {
41
+ this.transport = transport
42
+ this[kConfigurationError] = ConfigurationError
43
+ }
44
+
45
+ NodesApi.prototype.clearMeteringArchive = function nodesClearMeteringArchiveApi (params, options, callback) {
46
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
47
+
48
+ // check required parameters
49
+ if (params.node_id == null && params.nodeId == null) {
50
+ const err = new this[kConfigurationError]('Missing required parameter: node_id or nodeId')
51
+ return handleError(err, callback)
52
+ }
53
+ if (params.max_archive_version == null && params.maxArchiveVersion == null) {
54
+ const err = new this[kConfigurationError]('Missing required parameter: max_archive_version or maxArchiveVersion')
55
+ return handleError(err, callback)
56
+ }
57
+
58
+ // check required url components
59
+ if ((params.max_archive_version != null || params.maxArchiveVersion != null) && ((params.node_id == null && params.nodeId == null))) {
60
+ const err = new this[kConfigurationError]('Missing required parameter of the url: node_id')
61
+ return handleError(err, callback)
62
+ }
63
+
64
+ let { method, body, nodeId, node_id, maxArchiveVersion, max_archive_version, ...querystring } = params
65
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
66
+
67
+ let path = ''
68
+ if (method == null) method = 'DELETE'
69
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + '_repositories_metering' + '/' + encodeURIComponent(max_archive_version || maxArchiveVersion)
70
+
71
+ // build request object
72
+ const request = {
73
+ method,
74
+ path,
75
+ body: body || '',
76
+ querystring
77
+ }
78
+
79
+ return this.transport.request(request, options, callback)
80
+ }
81
+
82
+ NodesApi.prototype.getMeteringInfo = function nodesGetMeteringInfoApi (params, options, callback) {
83
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
84
+
85
+ // check required parameters
86
+ if (params.node_id == null && params.nodeId == null) {
87
+ const err = new this[kConfigurationError]('Missing required parameter: node_id or nodeId')
88
+ return handleError(err, callback)
89
+ }
90
+
91
+ let { method, body, nodeId, node_id, ...querystring } = params
92
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
93
+
94
+ let path = ''
95
+ if (method == null) method = 'GET'
96
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + '_repositories_metering'
97
+
98
+ // build request object
99
+ const request = {
100
+ method,
101
+ path,
102
+ body: null,
103
+ querystring
104
+ }
105
+
106
+ return this.transport.request(request, options, callback)
107
+ }
108
+
109
+ NodesApi.prototype.hotThreads = function nodesHotThreadsApi (params, options, callback) {
110
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
111
+
112
+ let { method, body, nodeId, node_id, ...querystring } = params
113
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
114
+
115
+ let path = ''
116
+ if ((node_id || nodeId) != null) {
117
+ if (method == null) method = 'GET'
118
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads'
119
+ } else if ((node_id || nodeId) != null) {
120
+ if (method == null) method = 'GET'
121
+ path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads'
122
+ } else if ((node_id || nodeId) != null) {
123
+ if (method == null) method = 'GET'
124
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads'
125
+ } else if ((node_id || nodeId) != null) {
126
+ if (method == null) method = 'GET'
127
+ path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads'
128
+ } else {
129
+ if (method == null) method = 'GET'
130
+ path = '/' + '_nodes' + '/' + 'hot_threads'
131
+ }
132
+
133
+ // build request object
134
+ const request = {
135
+ method,
136
+ path,
137
+ body: null,
138
+ querystring
139
+ }
140
+
141
+ return this.transport.request(request, options, callback)
142
+ }
143
+
144
+ NodesApi.prototype.info = function nodesInfoApi (params, options, callback) {
145
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
146
+
147
+ let { method, body, nodeId, node_id, metric, ...querystring } = params
148
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
149
+
150
+ let path = ''
151
+ if ((node_id || nodeId) != null && (metric) != null) {
152
+ if (method == null) method = 'GET'
153
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + encodeURIComponent(metric)
154
+ } else if ((node_id || nodeId) != null) {
155
+ if (method == null) method = 'GET'
156
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId)
157
+ } else if ((metric) != null) {
158
+ if (method == null) method = 'GET'
159
+ path = '/' + '_nodes' + '/' + encodeURIComponent(metric)
160
+ } else {
161
+ if (method == null) method = 'GET'
162
+ path = '/' + '_nodes'
163
+ }
164
+
165
+ // build request object
166
+ const request = {
167
+ method,
168
+ path,
169
+ body: null,
170
+ querystring
171
+ }
172
+
173
+ return this.transport.request(request, options, callback)
174
+ }
175
+
176
+ NodesApi.prototype.reloadSecureSettings = function nodesReloadSecureSettingsApi (params, options, callback) {
177
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
178
+
179
+ let { method, body, nodeId, node_id, ...querystring } = params
180
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
181
+
182
+ let path = ''
183
+ if ((node_id || nodeId) != null) {
184
+ if (method == null) method = 'POST'
185
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'reload_secure_settings'
186
+ } else {
187
+ if (method == null) method = 'POST'
188
+ path = '/' + '_nodes' + '/' + 'reload_secure_settings'
189
+ }
190
+
191
+ // build request object
192
+ const request = {
193
+ method,
194
+ path,
195
+ body: body || '',
196
+ querystring
197
+ }
198
+
199
+ return this.transport.request(request, options, callback)
200
+ }
201
+
202
+ NodesApi.prototype.stats = function nodesStatsApi (params, options, callback) {
203
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
204
+
205
+ let { method, body, nodeId, node_id, metric, indexMetric, index_metric, ...querystring } = params
206
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
207
+
208
+ let path = ''
209
+ if ((node_id || nodeId) != null && (metric) != null && (index_metric || indexMetric) != null) {
210
+ if (method == null) method = 'GET'
211
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'stats' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index_metric || indexMetric)
212
+ } else if ((node_id || nodeId) != null && (metric) != null) {
213
+ if (method == null) method = 'GET'
214
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'stats' + '/' + encodeURIComponent(metric)
215
+ } else if ((metric) != null && (index_metric || indexMetric) != null) {
216
+ if (method == null) method = 'GET'
217
+ path = '/' + '_nodes' + '/' + 'stats' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index_metric || indexMetric)
218
+ } else if ((node_id || nodeId) != null) {
219
+ if (method == null) method = 'GET'
220
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'stats'
221
+ } else if ((metric) != null) {
222
+ if (method == null) method = 'GET'
223
+ path = '/' + '_nodes' + '/' + 'stats' + '/' + encodeURIComponent(metric)
224
+ } else {
225
+ if (method == null) method = 'GET'
226
+ path = '/' + '_nodes' + '/' + 'stats'
227
+ }
228
+
229
+ // build request object
230
+ const request = {
231
+ method,
232
+ path,
233
+ body: null,
234
+ querystring
235
+ }
236
+
237
+ return this.transport.request(request, options, callback)
238
+ }
239
+
240
+ NodesApi.prototype.usage = function nodesUsageApi (params, options, callback) {
241
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
242
+
243
+ let { method, body, nodeId, node_id, metric, ...querystring } = params
244
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
245
+
246
+ let path = ''
247
+ if ((node_id || nodeId) != null && (metric) != null) {
248
+ if (method == null) method = 'GET'
249
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'usage' + '/' + encodeURIComponent(metric)
250
+ } else if ((node_id || nodeId) != null) {
251
+ if (method == null) method = 'GET'
252
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'usage'
253
+ } else if ((metric) != null) {
254
+ if (method == null) method = 'GET'
255
+ path = '/' + '_nodes' + '/' + 'usage' + '/' + encodeURIComponent(metric)
256
+ } else {
257
+ if (method == null) method = 'GET'
258
+ path = '/' + '_nodes' + '/' + 'usage'
259
+ }
260
+
261
+ // build request object
262
+ const request = {
263
+ method,
264
+ path,
265
+ body: null,
266
+ querystring
267
+ }
268
+
269
+ return this.transport.request(request, options, callback)
270
+ }
271
+
272
+ Object.defineProperties(NodesApi.prototype, {
273
+ clear_metering_archive: { get () { return this.clearMeteringArchive } },
274
+ get_metering_info: { get () { return this.getMeteringInfo } },
275
+ hot_threads: { get () { return this.hotThreads } },
276
+ reload_secure_settings: { get () { return this.reloadSecureSettings } }
277
+ })
278
+
279
+ module.exports = NodesApi
@@ -0,0 +1,61 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function pingApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ let { method, body, ...querystring } = params
44
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
45
+
46
+ let path = ''
47
+ if (method == null) method = 'HEAD'
48
+ path = '/'
49
+
50
+ // build request object
51
+ const request = {
52
+ method,
53
+ path,
54
+ body: null,
55
+ querystring
56
+ }
57
+
58
+ return this.transport.request(request, options, callback)
59
+ }
60
+
61
+ module.exports = pingApi
@@ -0,0 +1,82 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['timeout', 'master_timeout', 'context', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function putScriptApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.id == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: id')
46
+ return handleError(err, callback)
47
+ }
48
+ if (params.body == null) {
49
+ const err = new this[kConfigurationError]('Missing required parameter: body')
50
+ return handleError(err, callback)
51
+ }
52
+
53
+ // check required url components
54
+ if (params.context != null && (params.id == null)) {
55
+ const err = new this[kConfigurationError]('Missing required parameter of the url: id')
56
+ return handleError(err, callback)
57
+ }
58
+
59
+ let { method, body, id, context, ...querystring } = params
60
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
61
+
62
+ let path = ''
63
+ if ((id) != null && (context) != null) {
64
+ if (method == null) method = 'PUT'
65
+ path = '/' + '_scripts' + '/' + encodeURIComponent(id) + '/' + encodeURIComponent(context)
66
+ } else {
67
+ if (method == null) method = 'PUT'
68
+ path = '/' + '_scripts' + '/' + encodeURIComponent(id)
69
+ }
70
+
71
+ // build request object
72
+ const request = {
73
+ method,
74
+ path,
75
+ body: body || '',
76
+ querystring
77
+ }
78
+
79
+ return this.transport.request(request, options, callback)
80
+ }
81
+
82
+ module.exports = putScriptApi
@@ -0,0 +1,72 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'search_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function rankEvalApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.body == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: body')
46
+ return handleError(err, callback)
47
+ }
48
+
49
+ let { method, body, index, ...querystring } = params
50
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
51
+
52
+ let path = ''
53
+ if ((index) != null) {
54
+ if (method == null) method = body == null ? 'GET' : 'POST'
55
+ path = '/' + encodeURIComponent(index) + '/' + '_rank_eval'
56
+ } else {
57
+ if (method == null) method = body == null ? 'GET' : 'POST'
58
+ path = '/' + '_rank_eval'
59
+ }
60
+
61
+ // build request object
62
+ const request = {
63
+ method,
64
+ path,
65
+ body: body || '',
66
+ querystring
67
+ }
68
+
69
+ return this.transport.request(request, options, callback)
70
+ }
71
+
72
+ module.exports = rankEvalApi
@@ -0,0 +1,67 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['refresh', 'timeout', 'wait_for_active_shards', 'wait_for_completion', 'requests_per_second', 'scroll', 'slices', 'max_docs', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { waitForActiveShards: 'wait_for_active_shards', waitForCompletion: 'wait_for_completion', requestsPerSecond: 'requests_per_second', maxDocs: 'max_docs', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function reindexApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.body == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: body')
46
+ return handleError(err, callback)
47
+ }
48
+
49
+ let { method, body, ...querystring } = params
50
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
51
+
52
+ let path = ''
53
+ if (method == null) method = 'POST'
54
+ path = '/' + '_reindex'
55
+
56
+ // build request object
57
+ const request = {
58
+ method,
59
+ path,
60
+ body: body || '',
61
+ querystring
62
+ }
63
+
64
+ return this.transport.request(request, options, callback)
65
+ }
66
+
67
+ module.exports = reindexApi
@@ -0,0 +1,71 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { requestsPerSecond: 'requests_per_second', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function reindexRethrottleApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.task_id == null && params.taskId == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId')
46
+ return handleError(err, callback)
47
+ }
48
+ if (params.requests_per_second == null && params.requestsPerSecond == null) {
49
+ const err = new this[kConfigurationError]('Missing required parameter: requests_per_second or requestsPerSecond')
50
+ return handleError(err, callback)
51
+ }
52
+
53
+ let { method, body, taskId, task_id, ...querystring } = params
54
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
55
+
56
+ let path = ''
57
+ if (method == null) method = 'POST'
58
+ path = '/' + '_reindex' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle'
59
+
60
+ // build request object
61
+ const request = {
62
+ method,
63
+ path,
64
+ body: body || '',
65
+ querystring
66
+ }
67
+
68
+ return this.transport.request(request, options, callback)
69
+ }
70
+
71
+ module.exports = reindexRethrottleApi