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