@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.
- package/.eslintignore +2 -0
- package/.eslintrc.json +31 -0
- package/.prettierrc.json +5 -0
- package/.whitesource +15 -0
- package/ADMINS.md +13 -31
- package/CHANGELOG.md +24 -0
- package/COMPATIBILITY.md +27 -0
- package/DEVELOPER_GUIDE.md +22 -5
- package/MAINTAINERS.md +15 -70
- package/Makefile +2 -12
- package/README.md +19 -123
- package/RELEASING.md +3 -3
- package/SECURITY.md +1 -1
- package/USER_GUIDE.md +197 -0
- package/api/api/bulk.js +54 -28
- package/api/api/cat.js +355 -266
- package/api/api/clear_scroll.js +18 -19
- package/api/api/cluster.js +367 -221
- package/api/api/count.js +56 -26
- package/api/api/create.js +51 -26
- package/api/api/dangling_indices.js +96 -53
- package/api/api/delete.js +50 -24
- package/api/api/delete_by_query.js +89 -27
- package/api/api/delete_by_query_rethrottle.js +34 -21
- package/api/api/delete_script.js +32 -19
- package/api/api/exists.js +56 -24
- package/api/api/exists_source.js +61 -29
- package/api/api/explain.js +61 -24
- package/api/api/features.js +57 -37
- package/api/api/field_caps.js +37 -20
- package/api/api/get.js +56 -24
- package/api/api/get_script.js +31 -19
- package/api/api/get_script_context.js +16 -17
- package/api/api/get_script_languages.js +16 -17
- package/api/api/get_source.js +56 -24
- package/api/api/index.js +61 -30
- package/api/api/indices.js +1069 -859
- package/api/api/info.js +16 -17
- package/api/api/ingest.js +133 -98
- package/api/api/mget.js +51 -28
- package/api/api/msearch.js +50 -28
- package/api/api/msearch_template.js +54 -28
- package/api/api/mtermvectors.js +49 -26
- package/api/api/nodes.js +282 -156
- package/api/api/ping.js +16 -17
- package/api/api/put_script.js +41 -27
- package/api/api/rank_eval.js +38 -22
- package/api/api/reindex.js +39 -19
- package/api/api/reindex_rethrottle.js +33 -21
- package/api/api/render_search_template.js +19 -20
- package/api/api/scripts_painless_execute.js +16 -17
- package/api/api/scroll.js +32 -19
- package/api/api/search.js +109 -26
- package/api/api/search_shards.js +37 -20
- package/api/api/search_template.js +65 -28
- package/api/api/shutdown.js +67 -56
- package/api/api/snapshot.js +348 -226
- package/api/api/tasks.js +66 -48
- package/api/api/terms_enum.js +18 -19
- package/api/api/termvectors.js +58 -28
- package/api/api/update.js +65 -26
- package/api/api/update_by_query.js +90 -25
- package/api/api/update_by_query_rethrottle.js +34 -21
- package/api/index.js +268 -181
- package/api/new.d.ts +2043 -531
- package/api/opensearch_dashboards.d.ts +240 -238
- package/api/requestParams.d.ts +302 -71
- package/api/types.d.ts +6205 -5721
- package/api/utils.js +23 -24
- package/codecov.yml +2 -2
- package/index.d.ts +5203 -1037
- package/index.js +154 -143
- package/index.mjs +10 -11
- package/jenkins/release.JenkinsFile +11 -0
- package/lib/Connection.d.ts +38 -28
- package/lib/Connection.js +166 -170
- package/lib/Helpers.d.ts +108 -68
- package/lib/Helpers.js +401 -378
- package/lib/Serializer.d.ts +3 -4
- package/lib/Serializer.js +40 -41
- package/lib/Transport.d.ts +39 -15
- package/lib/Transport.js +381 -337
- package/lib/aws/AwsSigv4Signer.js +167 -0
- package/lib/aws/errors.js +24 -0
- package/lib/aws/index.d.ts +39 -0
- package/lib/aws/index.js +19 -0
- package/lib/errors.d.ts +26 -9
- package/lib/errors.js +76 -73
- package/lib/pool/BaseConnectionPool.js +101 -99
- package/lib/pool/CloudConnectionPool.js +17 -18
- package/lib/pool/ConnectionPool.js +106 -107
- package/lib/pool/index.d.ts +9 -8
- package/lib/pool/index.js +7 -8
- package/package.json +37 -15
package/api/api/info.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 infoApi
|
|
41
|
-
|
|
39
|
+
function infoApi(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 = 'GET'
|
|
48
|
-
path = '/'
|
|
45
|
+
let path = '';
|
|
46
|
+
if (method == null) method = 'GET';
|
|
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 = infoApi
|
|
60
|
+
module.exports = infoApi;
|
package/api/api/ingest.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,81 +27,97 @@
|
|
|
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 = [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
36
|
+
const acceptedQuerystring = [
|
|
37
|
+
'cluster_manager_timeout',
|
|
38
|
+
'master_timeout',
|
|
39
|
+
'timeout',
|
|
40
|
+
'pretty',
|
|
41
|
+
'human',
|
|
42
|
+
'error_trace',
|
|
43
|
+
'source',
|
|
44
|
+
'filter_path',
|
|
45
|
+
'summary',
|
|
46
|
+
'verbose',
|
|
47
|
+
];
|
|
48
|
+
const snakeCase = {
|
|
49
|
+
clusterManagerTimeout: 'cluster_manager_timeout',
|
|
50
|
+
masterTimeout: 'master_timeout',
|
|
51
|
+
errorTrace: 'error_trace',
|
|
52
|
+
filterPath: 'filter_path',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
function IngestApi(transport, ConfigurationError) {
|
|
56
|
+
this.transport = transport;
|
|
57
|
+
this[kConfigurationError] = ConfigurationError;
|
|
43
58
|
}
|
|
44
59
|
|
|
45
|
-
IngestApi.prototype.deletePipeline = function ingestDeletePipelineApi
|
|
46
|
-
|
|
60
|
+
IngestApi.prototype.deletePipeline = function ingestDeletePipelineApi(params, options, callback) {
|
|
61
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
47
62
|
|
|
48
63
|
// check required parameters
|
|
49
64
|
if (params.id == null) {
|
|
50
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
51
|
-
return handleError(err, callback)
|
|
65
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
66
|
+
return handleError(err, callback);
|
|
52
67
|
}
|
|
53
68
|
|
|
54
|
-
let { method, body, id, ...querystring } = params
|
|
55
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
69
|
+
let { method, body, id, ...querystring } = params;
|
|
70
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
56
71
|
|
|
57
|
-
let path = ''
|
|
58
|
-
if (method == null) method = 'DELETE'
|
|
59
|
-
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id)
|
|
72
|
+
let path = '';
|
|
73
|
+
if (method == null) method = 'DELETE';
|
|
74
|
+
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id);
|
|
60
75
|
|
|
61
76
|
// build request object
|
|
62
77
|
const request = {
|
|
63
78
|
method,
|
|
64
79
|
path,
|
|
65
80
|
body: body || '',
|
|
66
|
-
querystring
|
|
67
|
-
}
|
|
81
|
+
querystring,
|
|
82
|
+
};
|
|
68
83
|
|
|
69
|
-
return this.transport.request(request, options, callback)
|
|
70
|
-
}
|
|
84
|
+
return this.transport.request(request, options, callback);
|
|
85
|
+
};
|
|
71
86
|
|
|
72
|
-
IngestApi.prototype.geoIpStats = function ingestGeoIpStatsApi
|
|
73
|
-
|
|
87
|
+
IngestApi.prototype.geoIpStats = function ingestGeoIpStatsApi(params, options, callback) {
|
|
88
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
74
89
|
|
|
75
|
-
let { method, body, ...querystring } = params
|
|
76
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
90
|
+
let { method, body, ...querystring } = params;
|
|
91
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
77
92
|
|
|
78
|
-
let path = ''
|
|
79
|
-
if (method == null) method = 'GET'
|
|
80
|
-
path = '/' + '_ingest' + '/' + 'geoip' + '/' + 'stats'
|
|
93
|
+
let path = '';
|
|
94
|
+
if (method == null) method = 'GET';
|
|
95
|
+
path = '/' + '_ingest' + '/' + 'geoip' + '/' + 'stats';
|
|
81
96
|
|
|
82
97
|
// build request object
|
|
83
98
|
const request = {
|
|
84
99
|
method,
|
|
85
100
|
path,
|
|
86
101
|
body: null,
|
|
87
|
-
querystring
|
|
88
|
-
}
|
|
102
|
+
querystring,
|
|
103
|
+
};
|
|
89
104
|
|
|
90
|
-
return this.transport.request(request, options, callback)
|
|
91
|
-
}
|
|
105
|
+
return this.transport.request(request, options, callback);
|
|
106
|
+
};
|
|
92
107
|
|
|
93
|
-
IngestApi.prototype.getPipeline = function ingestGetPipelineApi
|
|
94
|
-
|
|
108
|
+
IngestApi.prototype.getPipeline = function ingestGetPipelineApi(params, options, callback) {
|
|
109
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
95
110
|
|
|
96
|
-
let { method, body, id, ...querystring } = params
|
|
97
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
111
|
+
let { method, body, id, ...querystring } = params;
|
|
112
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
98
113
|
|
|
99
|
-
let path = ''
|
|
100
|
-
if (
|
|
101
|
-
if (method == null) method = 'GET'
|
|
102
|
-
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id)
|
|
114
|
+
let path = '';
|
|
115
|
+
if (id != null) {
|
|
116
|
+
if (method == null) method = 'GET';
|
|
117
|
+
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id);
|
|
103
118
|
} else {
|
|
104
|
-
if (method == null) method = 'GET'
|
|
105
|
-
path = '/' + '_ingest' + '/' + 'pipeline'
|
|
119
|
+
if (method == null) method = 'GET';
|
|
120
|
+
path = '/' + '_ingest' + '/' + 'pipeline';
|
|
106
121
|
}
|
|
107
122
|
|
|
108
123
|
// build request object
|
|
@@ -110,83 +125,83 @@ IngestApi.prototype.getPipeline = function ingestGetPipelineApi (params, options
|
|
|
110
125
|
method,
|
|
111
126
|
path,
|
|
112
127
|
body: null,
|
|
113
|
-
querystring
|
|
114
|
-
}
|
|
128
|
+
querystring,
|
|
129
|
+
};
|
|
115
130
|
|
|
116
|
-
return this.transport.request(request, options, callback)
|
|
117
|
-
}
|
|
131
|
+
return this.transport.request(request, options, callback);
|
|
132
|
+
};
|
|
118
133
|
|
|
119
|
-
IngestApi.prototype.processorGrok = function ingestProcessorGrokApi
|
|
120
|
-
|
|
134
|
+
IngestApi.prototype.processorGrok = function ingestProcessorGrokApi(params, options, callback) {
|
|
135
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
121
136
|
|
|
122
|
-
let { method, body, ...querystring } = params
|
|
123
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
137
|
+
let { method, body, ...querystring } = params;
|
|
138
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
124
139
|
|
|
125
|
-
let path = ''
|
|
126
|
-
if (method == null) method = 'GET'
|
|
127
|
-
path = '/' + '_ingest' + '/' + 'processor' + '/' + 'grok'
|
|
140
|
+
let path = '';
|
|
141
|
+
if (method == null) method = 'GET';
|
|
142
|
+
path = '/' + '_ingest' + '/' + 'processor' + '/' + 'grok';
|
|
128
143
|
|
|
129
144
|
// build request object
|
|
130
145
|
const request = {
|
|
131
146
|
method,
|
|
132
147
|
path,
|
|
133
148
|
body: null,
|
|
134
|
-
querystring
|
|
135
|
-
}
|
|
149
|
+
querystring,
|
|
150
|
+
};
|
|
136
151
|
|
|
137
|
-
return this.transport.request(request, options, callback)
|
|
138
|
-
}
|
|
152
|
+
return this.transport.request(request, options, callback);
|
|
153
|
+
};
|
|
139
154
|
|
|
140
|
-
IngestApi.prototype.putPipeline = function ingestPutPipelineApi
|
|
141
|
-
|
|
155
|
+
IngestApi.prototype.putPipeline = function ingestPutPipelineApi(params, options, callback) {
|
|
156
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
142
157
|
|
|
143
158
|
// check required parameters
|
|
144
159
|
if (params.id == null) {
|
|
145
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
146
|
-
return handleError(err, callback)
|
|
160
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
161
|
+
return handleError(err, callback);
|
|
147
162
|
}
|
|
148
163
|
if (params.body == null) {
|
|
149
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
150
|
-
return handleError(err, callback)
|
|
164
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
165
|
+
return handleError(err, callback);
|
|
151
166
|
}
|
|
152
167
|
|
|
153
|
-
let { method, body, id, ...querystring } = params
|
|
154
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
168
|
+
let { method, body, id, ...querystring } = params;
|
|
169
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
155
170
|
|
|
156
|
-
let path = ''
|
|
157
|
-
if (method == null) method = 'PUT'
|
|
158
|
-
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id)
|
|
171
|
+
let path = '';
|
|
172
|
+
if (method == null) method = 'PUT';
|
|
173
|
+
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id);
|
|
159
174
|
|
|
160
175
|
// build request object
|
|
161
176
|
const request = {
|
|
162
177
|
method,
|
|
163
178
|
path,
|
|
164
179
|
body: body || '',
|
|
165
|
-
querystring
|
|
166
|
-
}
|
|
180
|
+
querystring,
|
|
181
|
+
};
|
|
167
182
|
|
|
168
|
-
return this.transport.request(request, options, callback)
|
|
169
|
-
}
|
|
183
|
+
return this.transport.request(request, options, callback);
|
|
184
|
+
};
|
|
170
185
|
|
|
171
|
-
IngestApi.prototype.simulate = function ingestSimulateApi
|
|
172
|
-
|
|
186
|
+
IngestApi.prototype.simulate = function ingestSimulateApi(params, options, callback) {
|
|
187
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
173
188
|
|
|
174
189
|
// check required parameters
|
|
175
190
|
if (params.body == null) {
|
|
176
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
177
|
-
return handleError(err, callback)
|
|
191
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
192
|
+
return handleError(err, callback);
|
|
178
193
|
}
|
|
179
194
|
|
|
180
|
-
let { method, body, id, ...querystring } = params
|
|
181
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
195
|
+
let { method, body, id, ...querystring } = params;
|
|
196
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
182
197
|
|
|
183
|
-
let path = ''
|
|
184
|
-
if (
|
|
185
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
186
|
-
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id) + '/' + '_simulate'
|
|
198
|
+
let path = '';
|
|
199
|
+
if (id != null) {
|
|
200
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
201
|
+
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id) + '/' + '_simulate';
|
|
187
202
|
} else {
|
|
188
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
189
|
-
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + '_simulate'
|
|
203
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
204
|
+
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + '_simulate';
|
|
190
205
|
}
|
|
191
206
|
|
|
192
207
|
// build request object
|
|
@@ -194,18 +209,38 @@ IngestApi.prototype.simulate = function ingestSimulateApi (params, options, call
|
|
|
194
209
|
method,
|
|
195
210
|
path,
|
|
196
211
|
body: body || '',
|
|
197
|
-
querystring
|
|
198
|
-
}
|
|
212
|
+
querystring,
|
|
213
|
+
};
|
|
199
214
|
|
|
200
|
-
return this.transport.request(request, options, callback)
|
|
201
|
-
}
|
|
215
|
+
return this.transport.request(request, options, callback);
|
|
216
|
+
};
|
|
202
217
|
|
|
203
218
|
Object.defineProperties(IngestApi.prototype, {
|
|
204
|
-
delete_pipeline: {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
219
|
+
delete_pipeline: {
|
|
220
|
+
get() {
|
|
221
|
+
return this.deletePipeline;
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
geo_ip_stats: {
|
|
225
|
+
get() {
|
|
226
|
+
return this.geoIpStats;
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
get_pipeline: {
|
|
230
|
+
get() {
|
|
231
|
+
return this.getPipeline;
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
processor_grok: {
|
|
235
|
+
get() {
|
|
236
|
+
return this.processorGrok;
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
put_pipeline: {
|
|
240
|
+
get() {
|
|
241
|
+
return this.putPipeline;
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
module.exports = IngestApi;
|
package/api/api/mget.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,43 +27,67 @@
|
|
|
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 = [
|
|
38
|
-
|
|
35
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
36
|
+
const acceptedQuerystring = [
|
|
37
|
+
'stored_fields',
|
|
38
|
+
'preference',
|
|
39
|
+
'realtime',
|
|
40
|
+
'refresh',
|
|
41
|
+
'routing',
|
|
42
|
+
'_source',
|
|
43
|
+
'_source_excludes',
|
|
44
|
+
'_source_exclude',
|
|
45
|
+
'_source_includes',
|
|
46
|
+
'_source_include',
|
|
47
|
+
'pretty',
|
|
48
|
+
'human',
|
|
49
|
+
'error_trace',
|
|
50
|
+
'source',
|
|
51
|
+
'filter_path',
|
|
52
|
+
];
|
|
53
|
+
const snakeCase = {
|
|
54
|
+
storedFields: 'stored_fields',
|
|
55
|
+
_sourceExcludes: '_source_excludes',
|
|
56
|
+
_sourceExclude: '_source_exclude',
|
|
57
|
+
_sourceIncludes: '_source_includes',
|
|
58
|
+
_sourceInclude: '_source_include',
|
|
59
|
+
errorTrace: 'error_trace',
|
|
60
|
+
filterPath: 'filter_path',
|
|
61
|
+
};
|
|
39
62
|
|
|
40
|
-
function mgetApi
|
|
41
|
-
|
|
63
|
+
function mgetApi(params, options, callback) {
|
|
64
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
65
|
|
|
43
66
|
// check required parameters
|
|
44
67
|
if (params.body == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
46
|
-
return handleError(err, callback)
|
|
68
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
69
|
+
return handleError(err, callback);
|
|
47
70
|
}
|
|
48
71
|
|
|
49
72
|
// check required url components
|
|
50
|
-
if (params.type != null &&
|
|
51
|
-
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
|
52
|
-
return handleError(err, callback)
|
|
73
|
+
if (params.type != null && params.index == null) {
|
|
74
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index');
|
|
75
|
+
return handleError(err, callback);
|
|
53
76
|
}
|
|
54
77
|
|
|
55
|
-
let { method, body, index, type, ...querystring } = params
|
|
56
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
78
|
+
let { method, body, index, type, ...querystring } = params;
|
|
79
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
57
80
|
|
|
58
|
-
let path = ''
|
|
59
|
-
if (
|
|
60
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
61
|
-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mget'
|
|
62
|
-
} else if (
|
|
63
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
64
|
-
path = '/' + encodeURIComponent(index) + '/' + '_mget'
|
|
81
|
+
let path = '';
|
|
82
|
+
if (index != null && type != null) {
|
|
83
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
84
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mget';
|
|
85
|
+
} else if (index != null) {
|
|
86
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
87
|
+
path = '/' + encodeURIComponent(index) + '/' + '_mget';
|
|
65
88
|
} else {
|
|
66
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
67
|
-
path = '/' + '_mget'
|
|
89
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
90
|
+
path = '/' + '_mget';
|
|
68
91
|
}
|
|
69
92
|
|
|
70
93
|
// build request object
|
|
@@ -72,10 +95,10 @@ function mgetApi (params, options, callback) {
|
|
|
72
95
|
method,
|
|
73
96
|
path,
|
|
74
97
|
body: body || '',
|
|
75
|
-
querystring
|
|
76
|
-
}
|
|
98
|
+
querystring,
|
|
99
|
+
};
|
|
77
100
|
|
|
78
|
-
return this.transport.request(request, options, callback)
|
|
101
|
+
return this.transport.request(request, options, callback);
|
|
79
102
|
}
|
|
80
103
|
|
|
81
|
-
module.exports = mgetApi
|
|
104
|
+
module.exports = mgetApi;
|
package/api/api/msearch.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,43 +27,66 @@
|
|
|
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 = [
|
|
38
|
-
|
|
35
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
36
|
+
const acceptedQuerystring = [
|
|
37
|
+
'search_type',
|
|
38
|
+
'max_concurrent_searches',
|
|
39
|
+
'typed_keys',
|
|
40
|
+
'pre_filter_shard_size',
|
|
41
|
+
'max_concurrent_shard_requests',
|
|
42
|
+
'rest_total_hits_as_int',
|
|
43
|
+
'ccs_minimize_roundtrips',
|
|
44
|
+
'pretty',
|
|
45
|
+
'human',
|
|
46
|
+
'error_trace',
|
|
47
|
+
'source',
|
|
48
|
+
'filter_path',
|
|
49
|
+
];
|
|
50
|
+
const snakeCase = {
|
|
51
|
+
searchType: 'search_type',
|
|
52
|
+
maxConcurrentSearches: 'max_concurrent_searches',
|
|
53
|
+
typedKeys: 'typed_keys',
|
|
54
|
+
preFilterShardSize: 'pre_filter_shard_size',
|
|
55
|
+
maxConcurrentShardRequests: 'max_concurrent_shard_requests',
|
|
56
|
+
restTotalHitsAsInt: 'rest_total_hits_as_int',
|
|
57
|
+
ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips',
|
|
58
|
+
errorTrace: 'error_trace',
|
|
59
|
+
filterPath: 'filter_path',
|
|
60
|
+
};
|
|
39
61
|
|
|
40
|
-
function msearchApi
|
|
41
|
-
|
|
62
|
+
function msearchApi(params, options, callback) {
|
|
63
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
64
|
|
|
43
65
|
// check required parameters
|
|
44
66
|
if (params.body == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
46
|
-
return handleError(err, callback)
|
|
67
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
68
|
+
return handleError(err, callback);
|
|
47
69
|
}
|
|
48
70
|
|
|
49
71
|
// check required url components
|
|
50
|
-
if (params.type != null &&
|
|
51
|
-
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
|
52
|
-
return handleError(err, callback)
|
|
72
|
+
if (params.type != null && params.index == null) {
|
|
73
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index');
|
|
74
|
+
return handleError(err, callback);
|
|
53
75
|
}
|
|
54
76
|
|
|
55
|
-
let { method, body, index, type, ...querystring } = params
|
|
56
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
77
|
+
let { method, body, index, type, ...querystring } = params;
|
|
78
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
57
79
|
|
|
58
|
-
let path = ''
|
|
59
|
-
if (
|
|
60
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
61
|
-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch'
|
|
62
|
-
} else if (
|
|
63
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
64
|
-
path = '/' + encodeURIComponent(index) + '/' + '_msearch'
|
|
80
|
+
let path = '';
|
|
81
|
+
if (index != null && type != null) {
|
|
82
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
83
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch';
|
|
84
|
+
} else if (index != null) {
|
|
85
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
86
|
+
path = '/' + encodeURIComponent(index) + '/' + '_msearch';
|
|
65
87
|
} else {
|
|
66
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
67
|
-
path = '/' + '_msearch'
|
|
88
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
89
|
+
path = '/' + '_msearch';
|
|
68
90
|
}
|
|
69
91
|
|
|
70
92
|
// build request object
|
|
@@ -72,10 +94,10 @@ function msearchApi (params, options, callback) {
|
|
|
72
94
|
method,
|
|
73
95
|
path,
|
|
74
96
|
bulkBody: body,
|
|
75
|
-
querystring
|
|
76
|
-
}
|
|
97
|
+
querystring,
|
|
98
|
+
};
|
|
77
99
|
|
|
78
|
-
return this.transport.request(request, options, callback)
|
|
100
|
+
return this.transport.request(request, options, callback);
|
|
79
101
|
}
|
|
80
102
|
|
|
81
|
-
module.exports = msearchApi
|
|
103
|
+
module.exports = msearchApi;
|