@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
|
@@ -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 getScriptLanguagesApi
|
|
41
|
-
|
|
39
|
+
function getScriptLanguagesApi(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 = '/' + '_script_language'
|
|
45
|
+
let path = '';
|
|
46
|
+
if (method == null) method = 'GET';
|
|
47
|
+
path = '/' + '_script_language';
|
|
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 = getScriptLanguagesApi
|
|
60
|
+
module.exports = getScriptLanguagesApi;
|
package/api/api/get_source.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,38 +27,71 @@
|
|
|
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
|
+
'preference',
|
|
38
|
+
'realtime',
|
|
39
|
+
'refresh',
|
|
40
|
+
'routing',
|
|
41
|
+
'_source',
|
|
42
|
+
'_source_excludes',
|
|
43
|
+
'_source_exclude',
|
|
44
|
+
'_source_includes',
|
|
45
|
+
'_source_include',
|
|
46
|
+
'version',
|
|
47
|
+
'version_type',
|
|
48
|
+
'pretty',
|
|
49
|
+
'human',
|
|
50
|
+
'error_trace',
|
|
51
|
+
'source',
|
|
52
|
+
'filter_path',
|
|
53
|
+
];
|
|
54
|
+
const snakeCase = {
|
|
55
|
+
_sourceExcludes: '_source_excludes',
|
|
56
|
+
_sourceExclude: '_source_exclude',
|
|
57
|
+
_sourceIncludes: '_source_includes',
|
|
58
|
+
_sourceInclude: '_source_include',
|
|
59
|
+
versionType: 'version_type',
|
|
60
|
+
errorTrace: 'error_trace',
|
|
61
|
+
filterPath: 'filter_path',
|
|
62
|
+
};
|
|
39
63
|
|
|
40
|
-
function getSourceApi
|
|
41
|
-
|
|
64
|
+
function getSourceApi(params, options, callback) {
|
|
65
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
66
|
|
|
43
67
|
// check required parameters
|
|
44
68
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
69
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
70
|
+
return handleError(err, callback);
|
|
47
71
|
}
|
|
48
72
|
if (params.index == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
50
|
-
return handleError(err, callback)
|
|
73
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
74
|
+
return handleError(err, callback);
|
|
51
75
|
}
|
|
52
76
|
|
|
53
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
77
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
78
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
79
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (
|
|
58
|
-
if (method == null) method = 'GET'
|
|
59
|
-
path =
|
|
80
|
+
let path = '';
|
|
81
|
+
if (index != null && type != null && id != null) {
|
|
82
|
+
if (method == null) method = 'GET';
|
|
83
|
+
path =
|
|
84
|
+
'/' +
|
|
85
|
+
encodeURIComponent(index) +
|
|
86
|
+
'/' +
|
|
87
|
+
encodeURIComponent(type) +
|
|
88
|
+
'/' +
|
|
89
|
+
encodeURIComponent(id) +
|
|
90
|
+
'/' +
|
|
91
|
+
'_source';
|
|
60
92
|
} else {
|
|
61
|
-
if (method == null) method = 'GET'
|
|
62
|
-
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
|
|
93
|
+
if (method == null) method = 'GET';
|
|
94
|
+
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id);
|
|
63
95
|
}
|
|
64
96
|
|
|
65
97
|
// build request object
|
|
@@ -67,10 +99,10 @@ function getSourceApi (params, options, callback) {
|
|
|
67
99
|
method,
|
|
68
100
|
path,
|
|
69
101
|
body: null,
|
|
70
|
-
querystring
|
|
71
|
-
}
|
|
102
|
+
querystring,
|
|
103
|
+
};
|
|
72
104
|
|
|
73
|
-
return this.transport.request(request, options, callback)
|
|
105
|
+
return this.transport.request(request, options, callback);
|
|
74
106
|
}
|
|
75
107
|
|
|
76
|
-
module.exports = getSourceApi
|
|
108
|
+
module.exports = getSourceApi;
|
package/api/api/index.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,44 +27,76 @@
|
|
|
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
|
+
'wait_for_active_shards',
|
|
38
|
+
'op_type',
|
|
39
|
+
'refresh',
|
|
40
|
+
'routing',
|
|
41
|
+
'timeout',
|
|
42
|
+
'version',
|
|
43
|
+
'version_type',
|
|
44
|
+
'if_seq_no',
|
|
45
|
+
'if_primary_term',
|
|
46
|
+
'pipeline',
|
|
47
|
+
'require_alias',
|
|
48
|
+
'pretty',
|
|
49
|
+
'human',
|
|
50
|
+
'error_trace',
|
|
51
|
+
'source',
|
|
52
|
+
'filter_path',
|
|
53
|
+
];
|
|
54
|
+
const snakeCase = {
|
|
55
|
+
waitForActiveShards: 'wait_for_active_shards',
|
|
56
|
+
opType: 'op_type',
|
|
57
|
+
versionType: 'version_type',
|
|
58
|
+
ifSeqNo: 'if_seq_no',
|
|
59
|
+
ifPrimaryTerm: 'if_primary_term',
|
|
60
|
+
requireAlias: 'require_alias',
|
|
61
|
+
errorTrace: 'error_trace',
|
|
62
|
+
filterPath: 'filter_path',
|
|
63
|
+
};
|
|
39
64
|
|
|
40
|
-
function indexApi
|
|
41
|
-
|
|
65
|
+
function indexApi(params, options, callback) {
|
|
66
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
67
|
|
|
43
68
|
// check required parameters
|
|
44
69
|
if (params.index == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
46
|
-
return handleError(err, callback)
|
|
70
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
71
|
+
return handleError(err, callback);
|
|
47
72
|
}
|
|
48
73
|
if (params.body == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
50
|
-
return handleError(err, callback)
|
|
74
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
75
|
+
return handleError(err, callback);
|
|
51
76
|
}
|
|
52
77
|
|
|
53
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
78
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
79
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
80
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (
|
|
58
|
-
if (method == null) method = 'PUT'
|
|
59
|
-
path =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
81
|
+
let path = '';
|
|
82
|
+
if (index != null && type != null && id != null) {
|
|
83
|
+
if (method == null) method = 'PUT';
|
|
84
|
+
path =
|
|
85
|
+
'/' +
|
|
86
|
+
encodeURIComponent(index) +
|
|
87
|
+
'/' +
|
|
88
|
+
encodeURIComponent(type) +
|
|
89
|
+
'/' +
|
|
90
|
+
encodeURIComponent(id);
|
|
91
|
+
} else if (index != null && id != null) {
|
|
92
|
+
if (method == null) method = 'PUT';
|
|
93
|
+
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id);
|
|
94
|
+
} else if (index != null && type != null) {
|
|
95
|
+
if (method == null) method = 'POST';
|
|
96
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type);
|
|
66
97
|
} else {
|
|
67
|
-
if (method == null) method = 'POST'
|
|
68
|
-
path = '/' + encodeURIComponent(index) + '/' + '_doc'
|
|
98
|
+
if (method == null) method = 'POST';
|
|
99
|
+
path = '/' + encodeURIComponent(index) + '/' + '_doc';
|
|
69
100
|
}
|
|
70
101
|
|
|
71
102
|
// build request object
|
|
@@ -73,10 +104,10 @@ function indexApi (params, options, callback) {
|
|
|
73
104
|
method,
|
|
74
105
|
path,
|
|
75
106
|
body: body || '',
|
|
76
|
-
querystring
|
|
77
|
-
}
|
|
107
|
+
querystring,
|
|
108
|
+
};
|
|
78
109
|
|
|
79
|
-
return this.transport.request(request, options, callback)
|
|
110
|
+
return this.transport.request(request, options, callback);
|
|
80
111
|
}
|
|
81
112
|
|
|
82
|
-
module.exports = indexApi
|
|
113
|
+
module.exports = indexApi;
|