@opensearch-project/opensearch 1.1.0 → 2.1.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 (94) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.json +31 -0
  3. package/.prettierrc.json +5 -0
  4. package/.whitesource +15 -0
  5. package/ADMINS.md +13 -31
  6. package/CHANGELOG.md +24 -0
  7. package/COMPATIBILITY.md +27 -0
  8. package/DEVELOPER_GUIDE.md +22 -5
  9. package/MAINTAINERS.md +15 -70
  10. package/Makefile +2 -12
  11. package/README.md +19 -123
  12. package/RELEASING.md +3 -3
  13. package/SECURITY.md +1 -1
  14. package/USER_GUIDE.md +197 -0
  15. package/api/api/bulk.js +54 -28
  16. package/api/api/cat.js +355 -266
  17. package/api/api/clear_scroll.js +18 -19
  18. package/api/api/cluster.js +367 -221
  19. package/api/api/count.js +56 -26
  20. package/api/api/create.js +51 -26
  21. package/api/api/dangling_indices.js +96 -53
  22. package/api/api/delete.js +50 -24
  23. package/api/api/delete_by_query.js +89 -27
  24. package/api/api/delete_by_query_rethrottle.js +34 -21
  25. package/api/api/delete_script.js +32 -19
  26. package/api/api/exists.js +56 -24
  27. package/api/api/exists_source.js +61 -29
  28. package/api/api/explain.js +61 -24
  29. package/api/api/features.js +57 -37
  30. package/api/api/field_caps.js +37 -20
  31. package/api/api/get.js +56 -24
  32. package/api/api/get_script.js +31 -19
  33. package/api/api/get_script_context.js +16 -17
  34. package/api/api/get_script_languages.js +16 -17
  35. package/api/api/get_source.js +56 -24
  36. package/api/api/index.js +61 -30
  37. package/api/api/indices.js +1069 -859
  38. package/api/api/info.js +16 -17
  39. package/api/api/ingest.js +133 -98
  40. package/api/api/mget.js +51 -28
  41. package/api/api/msearch.js +50 -28
  42. package/api/api/msearch_template.js +54 -28
  43. package/api/api/mtermvectors.js +49 -26
  44. package/api/api/nodes.js +282 -156
  45. package/api/api/ping.js +16 -17
  46. package/api/api/put_script.js +41 -27
  47. package/api/api/rank_eval.js +38 -22
  48. package/api/api/reindex.js +39 -19
  49. package/api/api/reindex_rethrottle.js +33 -21
  50. package/api/api/render_search_template.js +19 -20
  51. package/api/api/scripts_painless_execute.js +16 -17
  52. package/api/api/scroll.js +32 -19
  53. package/api/api/search.js +109 -26
  54. package/api/api/search_shards.js +37 -20
  55. package/api/api/search_template.js +65 -28
  56. package/api/api/shutdown.js +67 -56
  57. package/api/api/snapshot.js +348 -226
  58. package/api/api/tasks.js +66 -48
  59. package/api/api/terms_enum.js +18 -19
  60. package/api/api/termvectors.js +58 -28
  61. package/api/api/update.js +65 -26
  62. package/api/api/update_by_query.js +90 -25
  63. package/api/api/update_by_query_rethrottle.js +34 -21
  64. package/api/index.js +268 -181
  65. package/api/new.d.ts +2043 -531
  66. package/api/opensearch_dashboards.d.ts +240 -238
  67. package/api/requestParams.d.ts +302 -71
  68. package/api/types.d.ts +6205 -5721
  69. package/api/utils.js +23 -24
  70. package/codecov.yml +2 -2
  71. package/index.d.ts +5203 -1037
  72. package/index.js +154 -143
  73. package/index.mjs +10 -11
  74. package/jenkins/release.JenkinsFile +11 -0
  75. package/lib/Connection.d.ts +38 -28
  76. package/lib/Connection.js +166 -170
  77. package/lib/Helpers.d.ts +108 -68
  78. package/lib/Helpers.js +401 -378
  79. package/lib/Serializer.d.ts +3 -4
  80. package/lib/Serializer.js +40 -41
  81. package/lib/Transport.d.ts +39 -15
  82. package/lib/Transport.js +381 -337
  83. package/lib/aws/AwsSigv4Signer.js +167 -0
  84. package/lib/aws/errors.js +24 -0
  85. package/lib/aws/index.d.ts +39 -0
  86. package/lib/aws/index.js +19 -0
  87. package/lib/errors.d.ts +26 -9
  88. package/lib/errors.js +76 -73
  89. package/lib/pool/BaseConnectionPool.js +101 -99
  90. package/lib/pool/CloudConnectionPool.js +17 -18
  91. package/lib/pool/ConnectionPool.js +106 -107
  92. package/lib/pool/index.d.ts +9 -8
  93. package/lib/pool/index.js +7 -8
  94. package/package.json +37 -15
package/api/api/nodes.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
  /*
@@ -28,106 +27,172 @@
28
27
  * under the License.
29
28
  */
30
29
 
31
- 'use strict'
30
+ 'use strict';
32
31
 
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
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
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'pretty',
38
+ 'human',
39
+ 'error_trace',
40
+ 'source',
41
+ 'filter_path',
42
+ 'interval',
43
+ 'snapshots',
44
+ 'threads',
45
+ 'ignore_idle_threads',
46
+ 'type',
47
+ 'timeout',
48
+ 'flat_settings',
49
+ 'completion_fields',
50
+ 'fielddata_fields',
51
+ 'fields',
52
+ 'groups',
53
+ 'level',
54
+ 'types',
55
+ 'include_segment_file_sizes',
56
+ 'include_unloaded_segments',
57
+ ];
58
+ const snakeCase = {
59
+ errorTrace: 'error_trace',
60
+ filterPath: 'filter_path',
61
+ ignoreIdleThreads: 'ignore_idle_threads',
62
+ flatSettings: 'flat_settings',
63
+ completionFields: 'completion_fields',
64
+ fielddataFields: 'fielddata_fields',
65
+ includeSegmentFileSizes: 'include_segment_file_sizes',
66
+ includeUnloadedSegments: 'include_unloaded_segments',
67
+ };
68
+
69
+ function NodesApi(transport, ConfigurationError) {
70
+ this.transport = transport;
71
+ this[kConfigurationError] = ConfigurationError;
43
72
  }
44
73
 
45
- NodesApi.prototype.clearMeteringArchive = function nodesClearMeteringArchiveApi (params, options, callback) {
46
- ;[params, options, callback] = normalizeArguments(params, options, callback)
74
+ NodesApi.prototype.clearMeteringArchive = function nodesClearMeteringArchiveApi(
75
+ params,
76
+ options,
77
+ callback
78
+ ) {
79
+ [params, options, callback] = normalizeArguments(params, options, callback);
47
80
 
48
81
  // check required parameters
49
82
  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)
83
+ const err = new this[kConfigurationError]('Missing required parameter: node_id or nodeId');
84
+ return handleError(err, callback);
52
85
  }
53
86
  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)
87
+ const err = new this[kConfigurationError](
88
+ 'Missing required parameter: max_archive_version or maxArchiveVersion'
89
+ );
90
+ return handleError(err, callback);
56
91
  }
57
92
 
58
93
  // 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)
94
+ if (
95
+ (params.max_archive_version != null || params.maxArchiveVersion != null) &&
96
+ params.node_id == null &&
97
+ params.nodeId == null
98
+ ) {
99
+ const err = new this[kConfigurationError]('Missing required parameter of the url: node_id');
100
+ return handleError(err, callback);
62
101
  }
63
102
 
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)
103
+ let { method, body, nodeId, node_id, maxArchiveVersion, max_archive_version, ...querystring } =
104
+ params;
105
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
106
+
107
+ let path = '';
108
+ if (method == null) method = 'DELETE';
109
+ path =
110
+ '/' +
111
+ '_nodes' +
112
+ '/' +
113
+ encodeURIComponent(node_id || nodeId) +
114
+ '/' +
115
+ '_repositories_metering' +
116
+ '/' +
117
+ encodeURIComponent(max_archive_version || maxArchiveVersion);
70
118
 
71
119
  // build request object
72
120
  const request = {
73
121
  method,
74
122
  path,
75
123
  body: body || '',
76
- querystring
77
- }
124
+ querystring,
125
+ };
78
126
 
79
- return this.transport.request(request, options, callback)
80
- }
127
+ return this.transport.request(request, options, callback);
128
+ };
81
129
 
82
- NodesApi.prototype.getMeteringInfo = function nodesGetMeteringInfoApi (params, options, callback) {
83
- ;[params, options, callback] = normalizeArguments(params, options, callback)
130
+ NodesApi.prototype.getMeteringInfo = function nodesGetMeteringInfoApi(params, options, callback) {
131
+ [params, options, callback] = normalizeArguments(params, options, callback);
84
132
 
85
133
  // check required parameters
86
134
  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)
135
+ const err = new this[kConfigurationError]('Missing required parameter: node_id or nodeId');
136
+ return handleError(err, callback);
89
137
  }
90
138
 
91
- let { method, body, nodeId, node_id, ...querystring } = params
92
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
139
+ let { method, body, nodeId, node_id, ...querystring } = params;
140
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
93
141
 
94
- let path = ''
95
- if (method == null) method = 'GET'
96
- path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + '_repositories_metering'
142
+ let path = '';
143
+ if (method == null) method = 'GET';
144
+ path =
145
+ '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + '_repositories_metering';
97
146
 
98
147
  // build request object
99
148
  const request = {
100
149
  method,
101
150
  path,
102
151
  body: null,
103
- querystring
104
- }
152
+ querystring,
153
+ };
105
154
 
106
- return this.transport.request(request, options, callback)
107
- }
155
+ return this.transport.request(request, options, callback);
156
+ };
108
157
 
109
- NodesApi.prototype.hotThreads = function nodesHotThreadsApi (params, options, callback) {
110
- ;[params, options, callback] = normalizeArguments(params, options, callback)
158
+ NodesApi.prototype.hotThreads = function nodesHotThreadsApi(params, options, callback) {
159
+ [params, options, callback] = normalizeArguments(params, options, callback);
111
160
 
112
- let { method, body, nodeId, node_id, ...querystring } = params
113
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
161
+ let { method, body, nodeId, node_id, ...querystring } = params;
162
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
114
163
 
115
- let path = ''
164
+ let path = '';
116
165
  if ((node_id || nodeId) != null) {
117
- if (method == null) method = 'GET'
118
- path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads'
166
+ if (method == null) method = 'GET';
167
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads';
119
168
  } else if ((node_id || nodeId) != null) {
120
- if (method == null) method = 'GET'
121
- path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads'
169
+ if (method == null) method = 'GET';
170
+ path =
171
+ '/' +
172
+ '_cluster' +
173
+ '/' +
174
+ 'nodes' +
175
+ '/' +
176
+ encodeURIComponent(node_id || nodeId) +
177
+ '/' +
178
+ 'hotthreads';
122
179
  } else if ((node_id || nodeId) != null) {
123
- if (method == null) method = 'GET'
124
- path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads'
180
+ if (method == null) method = 'GET';
181
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads';
125
182
  } else if ((node_id || nodeId) != null) {
126
- if (method == null) method = 'GET'
127
- path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads'
183
+ if (method == null) method = 'GET';
184
+ path =
185
+ '/' +
186
+ '_cluster' +
187
+ '/' +
188
+ 'nodes' +
189
+ '/' +
190
+ encodeURIComponent(node_id || nodeId) +
191
+ '/' +
192
+ 'hot_threads';
128
193
  } else {
129
- if (method == null) method = 'GET'
130
- path = '/' + '_nodes' + '/' + 'hot_threads'
194
+ if (method == null) method = 'GET';
195
+ path = '/' + '_nodes' + '/' + 'hot_threads';
131
196
  }
132
197
 
133
198
  // build request object
@@ -135,31 +200,37 @@ NodesApi.prototype.hotThreads = function nodesHotThreadsApi (params, options, ca
135
200
  method,
136
201
  path,
137
202
  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)
203
+ querystring,
204
+ };
205
+
206
+ return this.transport.request(request, options, callback);
207
+ };
208
+
209
+ NodesApi.prototype.info = function nodesInfoApi(params, options, callback) {
210
+ [params, options, callback] = normalizeArguments(params, options, callback);
211
+
212
+ let { method, body, nodeId, node_id, metric, ...querystring } = params;
213
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
214
+
215
+ let path = '';
216
+ if ((node_id || nodeId) != null && metric != null) {
217
+ if (method == null) method = 'GET';
218
+ path =
219
+ '/' +
220
+ '_nodes' +
221
+ '/' +
222
+ encodeURIComponent(node_id || nodeId) +
223
+ '/' +
224
+ encodeURIComponent(metric);
154
225
  } 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)
226
+ if (method == null) method = 'GET';
227
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId);
228
+ } else if (metric != null) {
229
+ if (method == null) method = 'GET';
230
+ path = '/' + '_nodes' + '/' + encodeURIComponent(metric);
160
231
  } else {
161
- if (method == null) method = 'GET'
162
- path = '/' + '_nodes'
232
+ if (method == null) method = 'GET';
233
+ path = '/' + '_nodes';
163
234
  }
164
235
 
165
236
  // build request object
@@ -167,25 +238,30 @@ NodesApi.prototype.info = function nodesInfoApi (params, options, callback) {
167
238
  method,
168
239
  path,
169
240
  body: null,
170
- querystring
171
- }
241
+ querystring,
242
+ };
172
243
 
173
- return this.transport.request(request, options, callback)
174
- }
244
+ return this.transport.request(request, options, callback);
245
+ };
175
246
 
176
- NodesApi.prototype.reloadSecureSettings = function nodesReloadSecureSettingsApi (params, options, callback) {
177
- ;[params, options, callback] = normalizeArguments(params, options, callback)
247
+ NodesApi.prototype.reloadSecureSettings = function nodesReloadSecureSettingsApi(
248
+ params,
249
+ options,
250
+ callback
251
+ ) {
252
+ [params, options, callback] = normalizeArguments(params, options, callback);
178
253
 
179
- let { method, body, nodeId, node_id, ...querystring } = params
180
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
254
+ let { method, body, nodeId, node_id, ...querystring } = params;
255
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
181
256
 
182
- let path = ''
257
+ let path = '';
183
258
  if ((node_id || nodeId) != null) {
184
- if (method == null) method = 'POST'
185
- path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'reload_secure_settings'
259
+ if (method == null) method = 'POST';
260
+ path =
261
+ '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'reload_secure_settings';
186
262
  } else {
187
- if (method == null) method = 'POST'
188
- path = '/' + '_nodes' + '/' + 'reload_secure_settings'
263
+ if (method == null) method = 'POST';
264
+ path = '/' + '_nodes' + '/' + 'reload_secure_settings';
189
265
  }
190
266
 
191
267
  // build request object
@@ -193,37 +269,63 @@ NodesApi.prototype.reloadSecureSettings = function nodesReloadSecureSettingsApi
193
269
  method,
194
270
  path,
195
271
  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)
272
+ querystring,
273
+ };
274
+
275
+ return this.transport.request(request, options, callback);
276
+ };
277
+
278
+ NodesApi.prototype.stats = function nodesStatsApi(params, options, callback) {
279
+ [params, options, callback] = normalizeArguments(params, options, callback);
280
+
281
+ let { method, body, nodeId, node_id, metric, indexMetric, index_metric, ...querystring } = params;
282
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
283
+
284
+ let path = '';
285
+ if ((node_id || nodeId) != null && metric != null && (index_metric || indexMetric) != null) {
286
+ if (method == null) method = 'GET';
287
+ path =
288
+ '/' +
289
+ '_nodes' +
290
+ '/' +
291
+ encodeURIComponent(node_id || nodeId) +
292
+ '/' +
293
+ 'stats' +
294
+ '/' +
295
+ encodeURIComponent(metric) +
296
+ '/' +
297
+ encodeURIComponent(index_metric || indexMetric);
298
+ } else if ((node_id || nodeId) != null && metric != null) {
299
+ if (method == null) method = 'GET';
300
+ path =
301
+ '/' +
302
+ '_nodes' +
303
+ '/' +
304
+ encodeURIComponent(node_id || nodeId) +
305
+ '/' +
306
+ 'stats' +
307
+ '/' +
308
+ encodeURIComponent(metric);
309
+ } else if (metric != null && (index_metric || indexMetric) != null) {
310
+ if (method == null) method = 'GET';
311
+ path =
312
+ '/' +
313
+ '_nodes' +
314
+ '/' +
315
+ 'stats' +
316
+ '/' +
317
+ encodeURIComponent(metric) +
318
+ '/' +
319
+ encodeURIComponent(index_metric || indexMetric);
218
320
  } 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)
321
+ if (method == null) method = 'GET';
322
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'stats';
323
+ } else if (metric != null) {
324
+ if (method == null) method = 'GET';
325
+ path = '/' + '_nodes' + '/' + 'stats' + '/' + encodeURIComponent(metric);
224
326
  } else {
225
- if (method == null) method = 'GET'
226
- path = '/' + '_nodes' + '/' + 'stats'
327
+ if (method == null) method = 'GET';
328
+ path = '/' + '_nodes' + '/' + 'stats';
227
329
  }
228
330
 
229
331
  // build request object
@@ -231,31 +333,39 @@ NodesApi.prototype.stats = function nodesStatsApi (params, options, callback) {
231
333
  method,
232
334
  path,
233
335
  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)
336
+ querystring,
337
+ };
338
+
339
+ return this.transport.request(request, options, callback);
340
+ };
341
+
342
+ NodesApi.prototype.usage = function nodesUsageApi(params, options, callback) {
343
+ [params, options, callback] = normalizeArguments(params, options, callback);
344
+
345
+ let { method, body, nodeId, node_id, metric, ...querystring } = params;
346
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
347
+
348
+ let path = '';
349
+ if ((node_id || nodeId) != null && metric != null) {
350
+ if (method == null) method = 'GET';
351
+ path =
352
+ '/' +
353
+ '_nodes' +
354
+ '/' +
355
+ encodeURIComponent(node_id || nodeId) +
356
+ '/' +
357
+ 'usage' +
358
+ '/' +
359
+ encodeURIComponent(metric);
250
360
  } 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)
361
+ if (method == null) method = 'GET';
362
+ path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'usage';
363
+ } else if (metric != null) {
364
+ if (method == null) method = 'GET';
365
+ path = '/' + '_nodes' + '/' + 'usage' + '/' + encodeURIComponent(metric);
256
366
  } else {
257
- if (method == null) method = 'GET'
258
- path = '/' + '_nodes' + '/' + 'usage'
367
+ if (method == null) method = 'GET';
368
+ path = '/' + '_nodes' + '/' + 'usage';
259
369
  }
260
370
 
261
371
  // build request object
@@ -263,17 +373,33 @@ NodesApi.prototype.usage = function nodesUsageApi (params, options, callback) {
263
373
  method,
264
374
  path,
265
375
  body: null,
266
- querystring
267
- }
376
+ querystring,
377
+ };
268
378
 
269
- return this.transport.request(request, options, callback)
270
- }
379
+ return this.transport.request(request, options, callback);
380
+ };
271
381
 
272
382
  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
383
+ clear_metering_archive: {
384
+ get() {
385
+ return this.clearMeteringArchive;
386
+ },
387
+ },
388
+ get_metering_info: {
389
+ get() {
390
+ return this.getMeteringInfo;
391
+ },
392
+ },
393
+ hot_threads: {
394
+ get() {
395
+ return this.hotThreads;
396
+ },
397
+ },
398
+ reload_secure_settings: {
399
+ get() {
400
+ return this.reloadSecureSettings;
401
+ },
402
+ },
403
+ });
404
+
405
+ module.exports = NodesApi;
package/api/api/ping.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
  /*
@@ -28,34 +27,34 @@
28
27
  * under the License.
29
28
  */
30
29
 
31
- 'use strict'
30
+ 'use strict';
32
31
 
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
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' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path'];
37
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' };
39
38
 
40
- function pingApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
39
+ function pingApi(params, options, callback) {
40
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
41
 
43
- let { method, body, ...querystring } = params
44
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
42
+ let { method, body, ...querystring } = params;
43
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
45
44
 
46
- let path = ''
47
- if (method == null) method = 'HEAD'
48
- path = '/'
45
+ let path = '';
46
+ if (method == null) method = 'HEAD';
47
+ path = '/';
49
48
 
50
49
  // build request object
51
50
  const request = {
52
51
  method,
53
52
  path,
54
53
  body: null,
55
- querystring
56
- }
54
+ querystring,
55
+ };
57
56
 
58
- return this.transport.request(request, options, callback)
57
+ return this.transport.request(request, options, callback);
59
58
  }
60
59
 
61
- module.exports = pingApi
60
+ module.exports = pingApi;