@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
|
@@ -28,43 +28,70 @@
|
|
|
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
|
+
'typed_keys',
|
|
40
|
+
'max_concurrent_searches',
|
|
41
|
+
'rest_total_hits_as_int',
|
|
42
|
+
'ccs_minimize_roundtrips',
|
|
43
|
+
'pretty',
|
|
44
|
+
'human',
|
|
45
|
+
'error_trace',
|
|
46
|
+
'source',
|
|
47
|
+
'filter_path',
|
|
48
|
+
];
|
|
49
|
+
const snakeCase = {
|
|
50
|
+
searchType: 'search_type',
|
|
51
|
+
typedKeys: 'typed_keys',
|
|
52
|
+
maxConcurrentSearches: 'max_concurrent_searches',
|
|
53
|
+
restTotalHitsAsInt: 'rest_total_hits_as_int',
|
|
54
|
+
ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips',
|
|
55
|
+
errorTrace: 'error_trace',
|
|
56
|
+
filterPath: 'filter_path',
|
|
57
|
+
};
|
|
39
58
|
|
|
40
|
-
function msearchTemplateApi
|
|
41
|
-
|
|
59
|
+
function msearchTemplateApi(params, options, callback) {
|
|
60
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
61
|
|
|
43
62
|
// check required parameters
|
|
44
63
|
if (params.body == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
46
|
-
return handleError(err, callback)
|
|
64
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
65
|
+
return handleError(err, callback);
|
|
47
66
|
}
|
|
48
67
|
|
|
49
68
|
// 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)
|
|
69
|
+
if (params.type != null && params.index == null) {
|
|
70
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index');
|
|
71
|
+
return handleError(err, callback);
|
|
53
72
|
}
|
|
54
73
|
|
|
55
|
-
let { method, body, index, type, ...querystring } = params
|
|
56
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
74
|
+
let { method, body, index, type, ...querystring } = params;
|
|
75
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
57
76
|
|
|
58
|
-
let path = ''
|
|
59
|
-
if (
|
|
60
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
61
|
-
path =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
let path = '';
|
|
78
|
+
if (index != null && type != null) {
|
|
79
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
80
|
+
path =
|
|
81
|
+
'/' +
|
|
82
|
+
encodeURIComponent(index) +
|
|
83
|
+
'/' +
|
|
84
|
+
encodeURIComponent(type) +
|
|
85
|
+
'/' +
|
|
86
|
+
'_msearch' +
|
|
87
|
+
'/' +
|
|
88
|
+
'template';
|
|
89
|
+
} else if (index != null) {
|
|
90
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
91
|
+
path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template';
|
|
65
92
|
} else {
|
|
66
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
67
|
-
path = '/' + '_msearch' + '/' + 'template'
|
|
93
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
94
|
+
path = '/' + '_msearch' + '/' + 'template';
|
|
68
95
|
}
|
|
69
96
|
|
|
70
97
|
// build request object
|
|
@@ -72,10 +99,10 @@ function msearchTemplateApi (params, options, callback) {
|
|
|
72
99
|
method,
|
|
73
100
|
path,
|
|
74
101
|
bulkBody: body,
|
|
75
|
-
querystring
|
|
76
|
-
}
|
|
102
|
+
querystring,
|
|
103
|
+
};
|
|
77
104
|
|
|
78
|
-
return this.transport.request(request, options, callback)
|
|
105
|
+
return this.transport.request(request, options, callback);
|
|
79
106
|
}
|
|
80
107
|
|
|
81
|
-
module.exports = msearchTemplateApi
|
|
108
|
+
module.exports = msearchTemplateApi;
|
package/api/api/mtermvectors.js
CHANGED
|
@@ -28,37 +28,61 @@
|
|
|
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
|
+
'ids',
|
|
39
|
+
'term_statistics',
|
|
40
|
+
'field_statistics',
|
|
41
|
+
'fields',
|
|
42
|
+
'offsets',
|
|
43
|
+
'positions',
|
|
44
|
+
'payloads',
|
|
45
|
+
'preference',
|
|
46
|
+
'routing',
|
|
47
|
+
'realtime',
|
|
48
|
+
'version',
|
|
49
|
+
'version_type',
|
|
50
|
+
'pretty',
|
|
51
|
+
'human',
|
|
52
|
+
'error_trace',
|
|
53
|
+
'source',
|
|
54
|
+
'filter_path',
|
|
55
|
+
];
|
|
56
|
+
const snakeCase = {
|
|
57
|
+
termStatistics: 'term_statistics',
|
|
58
|
+
fieldStatistics: 'field_statistics',
|
|
59
|
+
versionType: 'version_type',
|
|
60
|
+
errorTrace: 'error_trace',
|
|
61
|
+
filterPath: 'filter_path',
|
|
62
|
+
};
|
|
39
63
|
|
|
40
|
-
function mtermvectorsApi
|
|
41
|
-
|
|
64
|
+
function mtermvectorsApi(params, options, callback) {
|
|
65
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
66
|
|
|
43
67
|
// check required url components
|
|
44
|
-
if (params.type != null &&
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
|
46
|
-
return handleError(err, callback)
|
|
68
|
+
if (params.type != null && params.index == null) {
|
|
69
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index');
|
|
70
|
+
return handleError(err, callback);
|
|
47
71
|
}
|
|
48
72
|
|
|
49
|
-
let { method, body, index, type, ...querystring } = params
|
|
50
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
73
|
+
let { method, body, index, type, ...querystring } = params;
|
|
74
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
51
75
|
|
|
52
|
-
let path = ''
|
|
53
|
-
if (
|
|
54
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
55
|
-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mtermvectors'
|
|
56
|
-
} else if (
|
|
57
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
58
|
-
path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors'
|
|
76
|
+
let path = '';
|
|
77
|
+
if (index != null && type != null) {
|
|
78
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
79
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mtermvectors';
|
|
80
|
+
} else if (index != null) {
|
|
81
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
82
|
+
path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors';
|
|
59
83
|
} else {
|
|
60
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
61
|
-
path = '/' + '_mtermvectors'
|
|
84
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
85
|
+
path = '/' + '_mtermvectors';
|
|
62
86
|
}
|
|
63
87
|
|
|
64
88
|
// build request object
|
|
@@ -66,10 +90,10 @@ function mtermvectorsApi (params, options, callback) {
|
|
|
66
90
|
method,
|
|
67
91
|
path,
|
|
68
92
|
body: body || '',
|
|
69
|
-
querystring
|
|
70
|
-
}
|
|
93
|
+
querystring,
|
|
94
|
+
};
|
|
71
95
|
|
|
72
|
-
return this.transport.request(request, options, callback)
|
|
96
|
+
return this.transport.request(request, options, callback);
|
|
73
97
|
}
|
|
74
98
|
|
|
75
|
-
module.exports = mtermvectorsApi
|
|
99
|
+
module.exports = mtermvectorsApi;
|