@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/info.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 infoApi
|
|
41
|
-
|
|
40
|
+
function infoApi(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 = 'GET'
|
|
48
|
-
path = '/'
|
|
46
|
+
let path = '';
|
|
47
|
+
if (method == null) method = 'GET';
|
|
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 = infoApi
|
|
61
|
+
module.exports = infoApi;
|
package/api/api/ingest.js
CHANGED
|
@@ -28,81 +28,97 @@
|
|
|
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
|
+
'cluster_manager_timeout',
|
|
39
|
+
'master_timeout',
|
|
40
|
+
'timeout',
|
|
41
|
+
'pretty',
|
|
42
|
+
'human',
|
|
43
|
+
'error_trace',
|
|
44
|
+
'source',
|
|
45
|
+
'filter_path',
|
|
46
|
+
'summary',
|
|
47
|
+
'verbose',
|
|
48
|
+
];
|
|
49
|
+
const snakeCase = {
|
|
50
|
+
clusterManagerTimeout: 'cluster_manager_timeout',
|
|
51
|
+
masterTimeout: 'master_timeout',
|
|
52
|
+
errorTrace: 'error_trace',
|
|
53
|
+
filterPath: 'filter_path',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
function IngestApi(transport, ConfigurationError) {
|
|
57
|
+
this.transport = transport;
|
|
58
|
+
this[kConfigurationError] = ConfigurationError;
|
|
43
59
|
}
|
|
44
60
|
|
|
45
|
-
IngestApi.prototype.deletePipeline = function ingestDeletePipelineApi
|
|
46
|
-
|
|
61
|
+
IngestApi.prototype.deletePipeline = function ingestDeletePipelineApi(params, options, callback) {
|
|
62
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
47
63
|
|
|
48
64
|
// check required parameters
|
|
49
65
|
if (params.id == null) {
|
|
50
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
51
|
-
return handleError(err, callback)
|
|
66
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
67
|
+
return handleError(err, callback);
|
|
52
68
|
}
|
|
53
69
|
|
|
54
|
-
let { method, body, id, ...querystring } = params
|
|
55
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
70
|
+
let { method, body, id, ...querystring } = params;
|
|
71
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
56
72
|
|
|
57
|
-
let path = ''
|
|
58
|
-
if (method == null) method = 'DELETE'
|
|
59
|
-
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id)
|
|
73
|
+
let path = '';
|
|
74
|
+
if (method == null) method = 'DELETE';
|
|
75
|
+
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id);
|
|
60
76
|
|
|
61
77
|
// build request object
|
|
62
78
|
const request = {
|
|
63
79
|
method,
|
|
64
80
|
path,
|
|
65
81
|
body: body || '',
|
|
66
|
-
querystring
|
|
67
|
-
}
|
|
82
|
+
querystring,
|
|
83
|
+
};
|
|
68
84
|
|
|
69
|
-
return this.transport.request(request, options, callback)
|
|
70
|
-
}
|
|
85
|
+
return this.transport.request(request, options, callback);
|
|
86
|
+
};
|
|
71
87
|
|
|
72
|
-
IngestApi.prototype.geoIpStats = function ingestGeoIpStatsApi
|
|
73
|
-
|
|
88
|
+
IngestApi.prototype.geoIpStats = function ingestGeoIpStatsApi(params, options, callback) {
|
|
89
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
74
90
|
|
|
75
|
-
let { method, body, ...querystring } = params
|
|
76
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
91
|
+
let { method, body, ...querystring } = params;
|
|
92
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
77
93
|
|
|
78
|
-
let path = ''
|
|
79
|
-
if (method == null) method = 'GET'
|
|
80
|
-
path = '/' + '_ingest' + '/' + 'geoip' + '/' + 'stats'
|
|
94
|
+
let path = '';
|
|
95
|
+
if (method == null) method = 'GET';
|
|
96
|
+
path = '/' + '_ingest' + '/' + 'geoip' + '/' + 'stats';
|
|
81
97
|
|
|
82
98
|
// build request object
|
|
83
99
|
const request = {
|
|
84
100
|
method,
|
|
85
101
|
path,
|
|
86
102
|
body: null,
|
|
87
|
-
querystring
|
|
88
|
-
}
|
|
103
|
+
querystring,
|
|
104
|
+
};
|
|
89
105
|
|
|
90
|
-
return this.transport.request(request, options, callback)
|
|
91
|
-
}
|
|
106
|
+
return this.transport.request(request, options, callback);
|
|
107
|
+
};
|
|
92
108
|
|
|
93
|
-
IngestApi.prototype.getPipeline = function ingestGetPipelineApi
|
|
94
|
-
|
|
109
|
+
IngestApi.prototype.getPipeline = function ingestGetPipelineApi(params, options, callback) {
|
|
110
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
95
111
|
|
|
96
|
-
let { method, body, id, ...querystring } = params
|
|
97
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
112
|
+
let { method, body, id, ...querystring } = params;
|
|
113
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
98
114
|
|
|
99
|
-
let path = ''
|
|
100
|
-
if (
|
|
101
|
-
if (method == null) method = 'GET'
|
|
102
|
-
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id)
|
|
115
|
+
let path = '';
|
|
116
|
+
if (id != null) {
|
|
117
|
+
if (method == null) method = 'GET';
|
|
118
|
+
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id);
|
|
103
119
|
} else {
|
|
104
|
-
if (method == null) method = 'GET'
|
|
105
|
-
path = '/' + '_ingest' + '/' + 'pipeline'
|
|
120
|
+
if (method == null) method = 'GET';
|
|
121
|
+
path = '/' + '_ingest' + '/' + 'pipeline';
|
|
106
122
|
}
|
|
107
123
|
|
|
108
124
|
// build request object
|
|
@@ -110,83 +126,83 @@ IngestApi.prototype.getPipeline = function ingestGetPipelineApi (params, options
|
|
|
110
126
|
method,
|
|
111
127
|
path,
|
|
112
128
|
body: null,
|
|
113
|
-
querystring
|
|
114
|
-
}
|
|
129
|
+
querystring,
|
|
130
|
+
};
|
|
115
131
|
|
|
116
|
-
return this.transport.request(request, options, callback)
|
|
117
|
-
}
|
|
132
|
+
return this.transport.request(request, options, callback);
|
|
133
|
+
};
|
|
118
134
|
|
|
119
|
-
IngestApi.prototype.processorGrok = function ingestProcessorGrokApi
|
|
120
|
-
|
|
135
|
+
IngestApi.prototype.processorGrok = function ingestProcessorGrokApi(params, options, callback) {
|
|
136
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
121
137
|
|
|
122
|
-
let { method, body, ...querystring } = params
|
|
123
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
138
|
+
let { method, body, ...querystring } = params;
|
|
139
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
124
140
|
|
|
125
|
-
let path = ''
|
|
126
|
-
if (method == null) method = 'GET'
|
|
127
|
-
path = '/' + '_ingest' + '/' + 'processor' + '/' + 'grok'
|
|
141
|
+
let path = '';
|
|
142
|
+
if (method == null) method = 'GET';
|
|
143
|
+
path = '/' + '_ingest' + '/' + 'processor' + '/' + 'grok';
|
|
128
144
|
|
|
129
145
|
// build request object
|
|
130
146
|
const request = {
|
|
131
147
|
method,
|
|
132
148
|
path,
|
|
133
149
|
body: null,
|
|
134
|
-
querystring
|
|
135
|
-
}
|
|
150
|
+
querystring,
|
|
151
|
+
};
|
|
136
152
|
|
|
137
|
-
return this.transport.request(request, options, callback)
|
|
138
|
-
}
|
|
153
|
+
return this.transport.request(request, options, callback);
|
|
154
|
+
};
|
|
139
155
|
|
|
140
|
-
IngestApi.prototype.putPipeline = function ingestPutPipelineApi
|
|
141
|
-
|
|
156
|
+
IngestApi.prototype.putPipeline = function ingestPutPipelineApi(params, options, callback) {
|
|
157
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
142
158
|
|
|
143
159
|
// check required parameters
|
|
144
160
|
if (params.id == null) {
|
|
145
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
146
|
-
return handleError(err, callback)
|
|
161
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
162
|
+
return handleError(err, callback);
|
|
147
163
|
}
|
|
148
164
|
if (params.body == null) {
|
|
149
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
150
|
-
return handleError(err, callback)
|
|
165
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
166
|
+
return handleError(err, callback);
|
|
151
167
|
}
|
|
152
168
|
|
|
153
|
-
let { method, body, id, ...querystring } = params
|
|
154
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
169
|
+
let { method, body, id, ...querystring } = params;
|
|
170
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
155
171
|
|
|
156
|
-
let path = ''
|
|
157
|
-
if (method == null) method = 'PUT'
|
|
158
|
-
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id)
|
|
172
|
+
let path = '';
|
|
173
|
+
if (method == null) method = 'PUT';
|
|
174
|
+
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id);
|
|
159
175
|
|
|
160
176
|
// build request object
|
|
161
177
|
const request = {
|
|
162
178
|
method,
|
|
163
179
|
path,
|
|
164
180
|
body: body || '',
|
|
165
|
-
querystring
|
|
166
|
-
}
|
|
181
|
+
querystring,
|
|
182
|
+
};
|
|
167
183
|
|
|
168
|
-
return this.transport.request(request, options, callback)
|
|
169
|
-
}
|
|
184
|
+
return this.transport.request(request, options, callback);
|
|
185
|
+
};
|
|
170
186
|
|
|
171
|
-
IngestApi.prototype.simulate = function ingestSimulateApi
|
|
172
|
-
|
|
187
|
+
IngestApi.prototype.simulate = function ingestSimulateApi(params, options, callback) {
|
|
188
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
173
189
|
|
|
174
190
|
// check required parameters
|
|
175
191
|
if (params.body == null) {
|
|
176
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
177
|
-
return handleError(err, callback)
|
|
192
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
193
|
+
return handleError(err, callback);
|
|
178
194
|
}
|
|
179
195
|
|
|
180
|
-
let { method, body, id, ...querystring } = params
|
|
181
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
196
|
+
let { method, body, id, ...querystring } = params;
|
|
197
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
182
198
|
|
|
183
|
-
let path = ''
|
|
184
|
-
if (
|
|
185
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
186
|
-
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id) + '/' + '_simulate'
|
|
199
|
+
let path = '';
|
|
200
|
+
if (id != null) {
|
|
201
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
202
|
+
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + encodeURIComponent(id) + '/' + '_simulate';
|
|
187
203
|
} else {
|
|
188
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
189
|
-
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + '_simulate'
|
|
204
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
205
|
+
path = '/' + '_ingest' + '/' + 'pipeline' + '/' + '_simulate';
|
|
190
206
|
}
|
|
191
207
|
|
|
192
208
|
// build request object
|
|
@@ -194,18 +210,38 @@ IngestApi.prototype.simulate = function ingestSimulateApi (params, options, call
|
|
|
194
210
|
method,
|
|
195
211
|
path,
|
|
196
212
|
body: body || '',
|
|
197
|
-
querystring
|
|
198
|
-
}
|
|
213
|
+
querystring,
|
|
214
|
+
};
|
|
199
215
|
|
|
200
|
-
return this.transport.request(request, options, callback)
|
|
201
|
-
}
|
|
216
|
+
return this.transport.request(request, options, callback);
|
|
217
|
+
};
|
|
202
218
|
|
|
203
219
|
Object.defineProperties(IngestApi.prototype, {
|
|
204
|
-
delete_pipeline: {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
220
|
+
delete_pipeline: {
|
|
221
|
+
get() {
|
|
222
|
+
return this.deletePipeline;
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
geo_ip_stats: {
|
|
226
|
+
get() {
|
|
227
|
+
return this.geoIpStats;
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
get_pipeline: {
|
|
231
|
+
get() {
|
|
232
|
+
return this.getPipeline;
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
processor_grok: {
|
|
236
|
+
get() {
|
|
237
|
+
return this.processorGrok;
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
put_pipeline: {
|
|
241
|
+
get() {
|
|
242
|
+
return this.putPipeline;
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
module.exports = IngestApi;
|
package/api/api/mget.js
CHANGED
|
@@ -28,43 +28,67 @@
|
|
|
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
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'stored_fields',
|
|
39
|
+
'preference',
|
|
40
|
+
'realtime',
|
|
41
|
+
'refresh',
|
|
42
|
+
'routing',
|
|
43
|
+
'_source',
|
|
44
|
+
'_source_excludes',
|
|
45
|
+
'_source_exclude',
|
|
46
|
+
'_source_includes',
|
|
47
|
+
'_source_include',
|
|
48
|
+
'pretty',
|
|
49
|
+
'human',
|
|
50
|
+
'error_trace',
|
|
51
|
+
'source',
|
|
52
|
+
'filter_path',
|
|
53
|
+
];
|
|
54
|
+
const snakeCase = {
|
|
55
|
+
storedFields: 'stored_fields',
|
|
56
|
+
_sourceExcludes: '_source_excludes',
|
|
57
|
+
_sourceExclude: '_source_exclude',
|
|
58
|
+
_sourceIncludes: '_source_includes',
|
|
59
|
+
_sourceInclude: '_source_include',
|
|
60
|
+
errorTrace: 'error_trace',
|
|
61
|
+
filterPath: 'filter_path',
|
|
62
|
+
};
|
|
39
63
|
|
|
40
|
-
function mgetApi
|
|
41
|
-
|
|
64
|
+
function mgetApi(params, options, callback) {
|
|
65
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
66
|
|
|
43
67
|
// check required parameters
|
|
44
68
|
if (params.body == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
46
|
-
return handleError(err, callback)
|
|
69
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
70
|
+
return handleError(err, callback);
|
|
47
71
|
}
|
|
48
72
|
|
|
49
73
|
// 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)
|
|
74
|
+
if (params.type != null && params.index == null) {
|
|
75
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index');
|
|
76
|
+
return handleError(err, callback);
|
|
53
77
|
}
|
|
54
78
|
|
|
55
|
-
let { method, body, index, type, ...querystring } = params
|
|
56
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
79
|
+
let { method, body, index, type, ...querystring } = params;
|
|
80
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
57
81
|
|
|
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'
|
|
82
|
+
let path = '';
|
|
83
|
+
if (index != null && type != null) {
|
|
84
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
85
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mget';
|
|
86
|
+
} else if (index != null) {
|
|
87
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
88
|
+
path = '/' + encodeURIComponent(index) + '/' + '_mget';
|
|
65
89
|
} else {
|
|
66
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
67
|
-
path = '/' + '_mget'
|
|
90
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
91
|
+
path = '/' + '_mget';
|
|
68
92
|
}
|
|
69
93
|
|
|
70
94
|
// build request object
|
|
@@ -72,10 +96,10 @@ function mgetApi (params, options, callback) {
|
|
|
72
96
|
method,
|
|
73
97
|
path,
|
|
74
98
|
body: body || '',
|
|
75
|
-
querystring
|
|
76
|
-
}
|
|
99
|
+
querystring,
|
|
100
|
+
};
|
|
77
101
|
|
|
78
|
-
return this.transport.request(request, options, callback)
|
|
102
|
+
return this.transport.request(request, options, callback);
|
|
79
103
|
}
|
|
80
104
|
|
|
81
|
-
module.exports = mgetApi
|
|
105
|
+
module.exports = mgetApi;
|
package/api/api/msearch.js
CHANGED
|
@@ -28,43 +28,66 @@
|
|
|
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
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'search_type',
|
|
39
|
+
'max_concurrent_searches',
|
|
40
|
+
'typed_keys',
|
|
41
|
+
'pre_filter_shard_size',
|
|
42
|
+
'max_concurrent_shard_requests',
|
|
43
|
+
'rest_total_hits_as_int',
|
|
44
|
+
'ccs_minimize_roundtrips',
|
|
45
|
+
'pretty',
|
|
46
|
+
'human',
|
|
47
|
+
'error_trace',
|
|
48
|
+
'source',
|
|
49
|
+
'filter_path',
|
|
50
|
+
];
|
|
51
|
+
const snakeCase = {
|
|
52
|
+
searchType: 'search_type',
|
|
53
|
+
maxConcurrentSearches: 'max_concurrent_searches',
|
|
54
|
+
typedKeys: 'typed_keys',
|
|
55
|
+
preFilterShardSize: 'pre_filter_shard_size',
|
|
56
|
+
maxConcurrentShardRequests: 'max_concurrent_shard_requests',
|
|
57
|
+
restTotalHitsAsInt: 'rest_total_hits_as_int',
|
|
58
|
+
ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips',
|
|
59
|
+
errorTrace: 'error_trace',
|
|
60
|
+
filterPath: 'filter_path',
|
|
61
|
+
};
|
|
39
62
|
|
|
40
|
-
function msearchApi
|
|
41
|
-
|
|
63
|
+
function msearchApi(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) + '/' + '_msearch'
|
|
62
|
-
} else if (
|
|
63
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
64
|
-
path = '/' + encodeURIComponent(index) + '/' + '_msearch'
|
|
81
|
+
let path = '';
|
|
82
|
+
if (index != null && type != null) {
|
|
83
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
84
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch';
|
|
85
|
+
} else if (index != null) {
|
|
86
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
87
|
+
path = '/' + encodeURIComponent(index) + '/' + '_msearch';
|
|
65
88
|
} else {
|
|
66
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
67
|
-
path = '/' + '_msearch'
|
|
89
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
90
|
+
path = '/' + '_msearch';
|
|
68
91
|
}
|
|
69
92
|
|
|
70
93
|
// build request object
|
|
@@ -72,10 +95,10 @@ function msearchApi (params, options, callback) {
|
|
|
72
95
|
method,
|
|
73
96
|
path,
|
|
74
97
|
bulkBody: 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 = msearchApi
|
|
104
|
+
module.exports = msearchApi;
|