@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,81 @@
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 = ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'type', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'pipeline', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function bulkApi (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
+ // check required url components
50
+ if (params.type != null && (params.index == null)) {
51
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
52
+ return handleError(err, callback)
53
+ }
54
+
55
+ let { method, body, index, type, ...querystring } = params
56
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
57
+
58
+ let path = ''
59
+ if ((index) != null && (type) != null) {
60
+ if (method == null) method = 'POST'
61
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_bulk'
62
+ } else if ((index) != null) {
63
+ if (method == null) method = 'POST'
64
+ path = '/' + encodeURIComponent(index) + '/' + '_bulk'
65
+ } else {
66
+ if (method == null) method = 'POST'
67
+ path = '/' + '_bulk'
68
+ }
69
+
70
+ // build request object
71
+ const request = {
72
+ method,
73
+ path,
74
+ bulkBody: body,
75
+ querystring
76
+ }
77
+
78
+ return this.transport.request(request, options, callback)
79
+ }
80
+
81
+ module.exports = bulkApi
package/api/api/cat.js ADDED
@@ -0,0 +1,525 @@
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 = ['format', 'local', 'h', 'help', 's', 'v', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'bytes', 'master_timeout', 'fields', 'time', 'ts', 'health', 'pri', 'include_unloaded_segments', 'allow_no_match', 'allow_no_datafeeds', 'allow_no_jobs', 'from', 'size', 'full_id', 'include_bootstrap', 'active_only', 'detailed', 'index', 'ignore_unavailable', 'nodes', 'actions', 'parent_task_id']
38
+ const snakeCase = { expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', includeUnloadedSegments: 'include_unloaded_segments', allowNoMatch: 'allow_no_match', allowNoDatafeeds: 'allow_no_datafeeds', allowNoJobs: 'allow_no_jobs', fullId: 'full_id', includeBootstrap: 'include_bootstrap', activeOnly: 'active_only', ignoreUnavailable: 'ignore_unavailable', parentTaskId: 'parent_task_id' }
39
+
40
+ function CatApi (transport, ConfigurationError) {
41
+ this.transport = transport
42
+ this[kConfigurationError] = ConfigurationError
43
+ }
44
+
45
+ CatApi.prototype.aliases = function catAliasesApi (params, options, callback) {
46
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
47
+
48
+ let { method, body, name, ...querystring } = params
49
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
50
+
51
+ let path = ''
52
+ if ((name) != null) {
53
+ if (method == null) method = 'GET'
54
+ path = '/' + '_cat' + '/' + 'aliases' + '/' + encodeURIComponent(name)
55
+ } else {
56
+ if (method == null) method = 'GET'
57
+ path = '/' + '_cat' + '/' + 'aliases'
58
+ }
59
+
60
+ // build request object
61
+ const request = {
62
+ method,
63
+ path,
64
+ body: null,
65
+ querystring
66
+ }
67
+
68
+ return this.transport.request(request, options, callback)
69
+ }
70
+
71
+ CatApi.prototype.allocation = function catAllocationApi (params, options, callback) {
72
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
73
+
74
+ let { method, body, nodeId, node_id, ...querystring } = params
75
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
76
+
77
+ let path = ''
78
+ if ((node_id || nodeId) != null) {
79
+ if (method == null) method = 'GET'
80
+ path = '/' + '_cat' + '/' + 'allocation' + '/' + encodeURIComponent(node_id || nodeId)
81
+ } else {
82
+ if (method == null) method = 'GET'
83
+ path = '/' + '_cat' + '/' + 'allocation'
84
+ }
85
+
86
+ // build request object
87
+ const request = {
88
+ method,
89
+ path,
90
+ body: null,
91
+ querystring
92
+ }
93
+
94
+ return this.transport.request(request, options, callback)
95
+ }
96
+
97
+ CatApi.prototype.count = function catCountApi (params, options, callback) {
98
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
99
+
100
+ let { method, body, index, ...querystring } = params
101
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
102
+
103
+ let path = ''
104
+ if ((index) != null) {
105
+ if (method == null) method = 'GET'
106
+ path = '/' + '_cat' + '/' + 'count' + '/' + encodeURIComponent(index)
107
+ } else {
108
+ if (method == null) method = 'GET'
109
+ path = '/' + '_cat' + '/' + 'count'
110
+ }
111
+
112
+ // build request object
113
+ const request = {
114
+ method,
115
+ path,
116
+ body: null,
117
+ querystring
118
+ }
119
+
120
+ return this.transport.request(request, options, callback)
121
+ }
122
+
123
+ CatApi.prototype.fielddata = function catFielddataApi (params, options, callback) {
124
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
125
+
126
+ let { method, body, fields, ...querystring } = params
127
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
128
+
129
+ let path = ''
130
+ if ((fields) != null) {
131
+ if (method == null) method = 'GET'
132
+ path = '/' + '_cat' + '/' + 'fielddata' + '/' + encodeURIComponent(fields)
133
+ } else {
134
+ if (method == null) method = 'GET'
135
+ path = '/' + '_cat' + '/' + 'fielddata'
136
+ }
137
+
138
+ // build request object
139
+ const request = {
140
+ method,
141
+ path,
142
+ body: null,
143
+ querystring
144
+ }
145
+
146
+ return this.transport.request(request, options, callback)
147
+ }
148
+
149
+ CatApi.prototype.health = function catHealthApi (params, options, callback) {
150
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
151
+
152
+ let { method, body, ...querystring } = params
153
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
154
+
155
+ let path = ''
156
+ if (method == null) method = 'GET'
157
+ path = '/' + '_cat' + '/' + 'health'
158
+
159
+ // build request object
160
+ const request = {
161
+ method,
162
+ path,
163
+ body: null,
164
+ querystring
165
+ }
166
+
167
+ return this.transport.request(request, options, callback)
168
+ }
169
+
170
+ CatApi.prototype.help = function catHelpApi (params, options, callback) {
171
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
172
+
173
+ let { method, body, ...querystring } = params
174
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
175
+
176
+ let path = ''
177
+ if (method == null) method = 'GET'
178
+ path = '/' + '_cat'
179
+
180
+ // build request object
181
+ const request = {
182
+ method,
183
+ path,
184
+ body: null,
185
+ querystring
186
+ }
187
+
188
+ return this.transport.request(request, options, callback)
189
+ }
190
+
191
+ CatApi.prototype.indices = function catIndicesApi (params, options, callback) {
192
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
193
+
194
+ let { method, body, index, ...querystring } = params
195
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
196
+
197
+ let path = ''
198
+ if ((index) != null) {
199
+ if (method == null) method = 'GET'
200
+ path = '/' + '_cat' + '/' + 'indices' + '/' + encodeURIComponent(index)
201
+ } else {
202
+ if (method == null) method = 'GET'
203
+ path = '/' + '_cat' + '/' + 'indices'
204
+ }
205
+
206
+ // build request object
207
+ const request = {
208
+ method,
209
+ path,
210
+ body: null,
211
+ querystring
212
+ }
213
+
214
+ return this.transport.request(request, options, callback)
215
+ }
216
+
217
+ CatApi.prototype.master = function catMasterApi (params, options, callback) {
218
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
219
+
220
+ let { method, body, ...querystring } = params
221
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
222
+
223
+ let path = ''
224
+ if (method == null) method = 'GET'
225
+ path = '/' + '_cat' + '/' + 'master'
226
+
227
+ // build request object
228
+ const request = {
229
+ method,
230
+ path,
231
+ body: null,
232
+ querystring
233
+ }
234
+
235
+ return this.transport.request(request, options, callback)
236
+ }
237
+
238
+ CatApi.prototype.nodeattrs = function catNodeattrsApi (params, options, callback) {
239
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
240
+
241
+ let { method, body, ...querystring } = params
242
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
243
+
244
+ let path = ''
245
+ if (method == null) method = 'GET'
246
+ path = '/' + '_cat' + '/' + 'nodeattrs'
247
+
248
+ // build request object
249
+ const request = {
250
+ method,
251
+ path,
252
+ body: null,
253
+ querystring
254
+ }
255
+
256
+ return this.transport.request(request, options, callback)
257
+ }
258
+
259
+ CatApi.prototype.nodes = function catNodesApi (params, options, callback) {
260
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
261
+
262
+ let { method, body, ...querystring } = params
263
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
264
+
265
+ let path = ''
266
+ if (method == null) method = 'GET'
267
+ path = '/' + '_cat' + '/' + 'nodes'
268
+
269
+ // build request object
270
+ const request = {
271
+ method,
272
+ path,
273
+ body: null,
274
+ querystring
275
+ }
276
+
277
+ return this.transport.request(request, options, callback)
278
+ }
279
+
280
+ CatApi.prototype.pendingTasks = function catPendingTasksApi (params, options, callback) {
281
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
282
+
283
+ let { method, body, ...querystring } = params
284
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
285
+
286
+ let path = ''
287
+ if (method == null) method = 'GET'
288
+ path = '/' + '_cat' + '/' + 'pending_tasks'
289
+
290
+ // build request object
291
+ const request = {
292
+ method,
293
+ path,
294
+ body: null,
295
+ querystring
296
+ }
297
+
298
+ return this.transport.request(request, options, callback)
299
+ }
300
+
301
+ CatApi.prototype.plugins = function catPluginsApi (params, options, callback) {
302
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
303
+
304
+ let { method, body, ...querystring } = params
305
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
306
+
307
+ let path = ''
308
+ if (method == null) method = 'GET'
309
+ path = '/' + '_cat' + '/' + 'plugins'
310
+
311
+ // build request object
312
+ const request = {
313
+ method,
314
+ path,
315
+ body: null,
316
+ querystring
317
+ }
318
+
319
+ return this.transport.request(request, options, callback)
320
+ }
321
+
322
+ CatApi.prototype.recovery = function catRecoveryApi (params, options, callback) {
323
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
324
+
325
+ let { method, body, index, ...querystring } = params
326
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
327
+
328
+ let path = ''
329
+ if ((index) != null) {
330
+ if (method == null) method = 'GET'
331
+ path = '/' + '_cat' + '/' + 'recovery' + '/' + encodeURIComponent(index)
332
+ } else {
333
+ if (method == null) method = 'GET'
334
+ path = '/' + '_cat' + '/' + 'recovery'
335
+ }
336
+
337
+ // build request object
338
+ const request = {
339
+ method,
340
+ path,
341
+ body: null,
342
+ querystring
343
+ }
344
+
345
+ return this.transport.request(request, options, callback)
346
+ }
347
+
348
+ CatApi.prototype.repositories = function catRepositoriesApi (params, options, callback) {
349
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
350
+
351
+ let { method, body, ...querystring } = params
352
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
353
+
354
+ let path = ''
355
+ if (method == null) method = 'GET'
356
+ path = '/' + '_cat' + '/' + 'repositories'
357
+
358
+ // build request object
359
+ const request = {
360
+ method,
361
+ path,
362
+ body: null,
363
+ querystring
364
+ }
365
+
366
+ return this.transport.request(request, options, callback)
367
+ }
368
+
369
+ CatApi.prototype.segments = function catSegmentsApi (params, options, callback) {
370
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
371
+
372
+ let { method, body, index, ...querystring } = params
373
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
374
+
375
+ let path = ''
376
+ if ((index) != null) {
377
+ if (method == null) method = 'GET'
378
+ path = '/' + '_cat' + '/' + 'segments' + '/' + encodeURIComponent(index)
379
+ } else {
380
+ if (method == null) method = 'GET'
381
+ path = '/' + '_cat' + '/' + 'segments'
382
+ }
383
+
384
+ // build request object
385
+ const request = {
386
+ method,
387
+ path,
388
+ body: null,
389
+ querystring
390
+ }
391
+
392
+ return this.transport.request(request, options, callback)
393
+ }
394
+
395
+ CatApi.prototype.shards = function catShardsApi (params, options, callback) {
396
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
397
+
398
+ let { method, body, index, ...querystring } = params
399
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
400
+
401
+ let path = ''
402
+ if ((index) != null) {
403
+ if (method == null) method = 'GET'
404
+ path = '/' + '_cat' + '/' + 'shards' + '/' + encodeURIComponent(index)
405
+ } else {
406
+ if (method == null) method = 'GET'
407
+ path = '/' + '_cat' + '/' + 'shards'
408
+ }
409
+
410
+ // build request object
411
+ const request = {
412
+ method,
413
+ path,
414
+ body: null,
415
+ querystring
416
+ }
417
+
418
+ return this.transport.request(request, options, callback)
419
+ }
420
+
421
+ CatApi.prototype.snapshots = function catSnapshotsApi (params, options, callback) {
422
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
423
+
424
+ let { method, body, repository, ...querystring } = params
425
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
426
+
427
+ let path = ''
428
+ if ((repository) != null) {
429
+ if (method == null) method = 'GET'
430
+ path = '/' + '_cat' + '/' + 'snapshots' + '/' + encodeURIComponent(repository)
431
+ } else {
432
+ if (method == null) method = 'GET'
433
+ path = '/' + '_cat' + '/' + 'snapshots'
434
+ }
435
+
436
+ // build request object
437
+ const request = {
438
+ method,
439
+ path,
440
+ body: null,
441
+ querystring
442
+ }
443
+
444
+ return this.transport.request(request, options, callback)
445
+ }
446
+
447
+ CatApi.prototype.tasks = function catTasksApi (params, options, callback) {
448
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
449
+
450
+ let { method, body, ...querystring } = params
451
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
452
+
453
+ let path = ''
454
+ if (method == null) method = 'GET'
455
+ path = '/' + '_cat' + '/' + 'tasks'
456
+
457
+ // build request object
458
+ const request = {
459
+ method,
460
+ path,
461
+ body: null,
462
+ querystring
463
+ }
464
+
465
+ return this.transport.request(request, options, callback)
466
+ }
467
+
468
+ CatApi.prototype.templates = function catTemplatesApi (params, options, callback) {
469
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
470
+
471
+ let { method, body, name, ...querystring } = params
472
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
473
+
474
+ let path = ''
475
+ if ((name) != null) {
476
+ if (method == null) method = 'GET'
477
+ path = '/' + '_cat' + '/' + 'templates' + '/' + encodeURIComponent(name)
478
+ } else {
479
+ if (method == null) method = 'GET'
480
+ path = '/' + '_cat' + '/' + 'templates'
481
+ }
482
+
483
+ // build request object
484
+ const request = {
485
+ method,
486
+ path,
487
+ body: null,
488
+ querystring
489
+ }
490
+
491
+ return this.transport.request(request, options, callback)
492
+ }
493
+
494
+ CatApi.prototype.threadPool = function catThreadPoolApi (params, options, callback) {
495
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
496
+
497
+ let { method, body, threadPoolPatterns, thread_pool_patterns, ...querystring } = params
498
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
499
+
500
+ let path = ''
501
+ if ((thread_pool_patterns || threadPoolPatterns) != null) {
502
+ if (method == null) method = 'GET'
503
+ path = '/' + '_cat' + '/' + 'thread_pool' + '/' + encodeURIComponent(thread_pool_patterns || threadPoolPatterns)
504
+ } else {
505
+ if (method == null) method = 'GET'
506
+ path = '/' + '_cat' + '/' + 'thread_pool'
507
+ }
508
+
509
+ // build request object
510
+ const request = {
511
+ method,
512
+ path,
513
+ body: null,
514
+ querystring
515
+ }
516
+
517
+ return this.transport.request(request, options, callback)
518
+ }
519
+
520
+ Object.defineProperties(CatApi.prototype, {
521
+ pending_tasks: { get () { return this.pendingTasks } },
522
+ thread_pool: { get () { return this.threadPool } }
523
+ })
524
+
525
+ module.exports = CatApi
@@ -0,0 +1,66 @@
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 clearScrollApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ let { method, body, scrollId, scroll_id, ...querystring } = params
44
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
45
+
46
+ let path = ''
47
+ if ((scroll_id || scrollId) != null) {
48
+ if (method == null) method = 'DELETE'
49
+ path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId)
50
+ } else {
51
+ if (method == null) method = 'DELETE'
52
+ path = '/' + '_search' + '/' + 'scroll'
53
+ }
54
+
55
+ // build request object
56
+ const request = {
57
+ method,
58
+ path,
59
+ body: body || '',
60
+ querystring
61
+ }
62
+
63
+ return this.transport.request(request, options, callback)
64
+ }
65
+
66
+ module.exports = clearScrollApi