@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/put_script.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,59 @@
|
|
|
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
|
+
'cluster_manager_timeout',
|
|
38
|
+
'timeout',
|
|
39
|
+
'master_timeout',
|
|
40
|
+
'context',
|
|
41
|
+
'pretty',
|
|
42
|
+
'human',
|
|
43
|
+
'error_trace',
|
|
44
|
+
'source',
|
|
45
|
+
'filter_path',
|
|
46
|
+
];
|
|
47
|
+
const snakeCase = {
|
|
48
|
+
clusterManagerTimeout: 'cluster_manager_timeout',
|
|
49
|
+
masterTimeout: 'master_timeout',
|
|
50
|
+
errorTrace: 'error_trace',
|
|
51
|
+
filterPath: 'filter_path',
|
|
52
|
+
};
|
|
39
53
|
|
|
40
|
-
function putScriptApi
|
|
41
|
-
|
|
54
|
+
function putScriptApi(params, options, callback) {
|
|
55
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
56
|
|
|
43
57
|
// check required parameters
|
|
44
58
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
59
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
60
|
+
return handleError(err, callback);
|
|
47
61
|
}
|
|
48
62
|
if (params.body == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
50
|
-
return handleError(err, callback)
|
|
63
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
64
|
+
return handleError(err, callback);
|
|
51
65
|
}
|
|
52
66
|
|
|
53
67
|
// check required url components
|
|
54
|
-
if (params.context != null &&
|
|
55
|
-
const err = new this[kConfigurationError]('Missing required parameter of the url: id')
|
|
56
|
-
return handleError(err, callback)
|
|
68
|
+
if (params.context != null && params.id == null) {
|
|
69
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: id');
|
|
70
|
+
return handleError(err, callback);
|
|
57
71
|
}
|
|
58
72
|
|
|
59
|
-
let { method, body, id, context, ...querystring } = params
|
|
60
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
73
|
+
let { method, body, id, context, ...querystring } = params;
|
|
74
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
61
75
|
|
|
62
|
-
let path = ''
|
|
63
|
-
if (
|
|
64
|
-
if (method == null) method = 'PUT'
|
|
65
|
-
path = '/' + '_scripts' + '/' + encodeURIComponent(id) + '/' + encodeURIComponent(context)
|
|
76
|
+
let path = '';
|
|
77
|
+
if (id != null && context != null) {
|
|
78
|
+
if (method == null) method = 'PUT';
|
|
79
|
+
path = '/' + '_scripts' + '/' + encodeURIComponent(id) + '/' + encodeURIComponent(context);
|
|
66
80
|
} else {
|
|
67
|
-
if (method == null) method = 'PUT'
|
|
68
|
-
path = '/' + '_scripts' + '/' + encodeURIComponent(id)
|
|
81
|
+
if (method == null) method = 'PUT';
|
|
82
|
+
path = '/' + '_scripts' + '/' + encodeURIComponent(id);
|
|
69
83
|
}
|
|
70
84
|
|
|
71
85
|
// build request object
|
|
@@ -73,10 +87,10 @@ function putScriptApi (params, options, callback) {
|
|
|
73
87
|
method,
|
|
74
88
|
path,
|
|
75
89
|
body: body || '',
|
|
76
|
-
querystring
|
|
77
|
-
}
|
|
90
|
+
querystring,
|
|
91
|
+
};
|
|
78
92
|
|
|
79
|
-
return this.transport.request(request, options, callback)
|
|
93
|
+
return this.transport.request(request, options, callback);
|
|
80
94
|
}
|
|
81
95
|
|
|
82
|
-
module.exports = putScriptApi
|
|
96
|
+
module.exports = putScriptApi;
|
package/api/api/rank_eval.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,51 @@
|
|
|
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
|
+
'ignore_unavailable',
|
|
38
|
+
'allow_no_indices',
|
|
39
|
+
'expand_wildcards',
|
|
40
|
+
'search_type',
|
|
41
|
+
'pretty',
|
|
42
|
+
'human',
|
|
43
|
+
'error_trace',
|
|
44
|
+
'source',
|
|
45
|
+
'filter_path',
|
|
46
|
+
];
|
|
47
|
+
const snakeCase = {
|
|
48
|
+
ignoreUnavailable: 'ignore_unavailable',
|
|
49
|
+
allowNoIndices: 'allow_no_indices',
|
|
50
|
+
expandWildcards: 'expand_wildcards',
|
|
51
|
+
searchType: 'search_type',
|
|
52
|
+
errorTrace: 'error_trace',
|
|
53
|
+
filterPath: 'filter_path',
|
|
54
|
+
};
|
|
39
55
|
|
|
40
|
-
function rankEvalApi
|
|
41
|
-
|
|
56
|
+
function rankEvalApi(params, options, callback) {
|
|
57
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
58
|
|
|
43
59
|
// check required parameters
|
|
44
60
|
if (params.body == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
46
|
-
return handleError(err, callback)
|
|
61
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
62
|
+
return handleError(err, callback);
|
|
47
63
|
}
|
|
48
64
|
|
|
49
|
-
let { method, body, index, ...querystring } = params
|
|
50
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
65
|
+
let { method, body, index, ...querystring } = params;
|
|
66
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
51
67
|
|
|
52
|
-
let path = ''
|
|
53
|
-
if (
|
|
54
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
55
|
-
path = '/' + encodeURIComponent(index) + '/' + '_rank_eval'
|
|
68
|
+
let path = '';
|
|
69
|
+
if (index != null) {
|
|
70
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
71
|
+
path = '/' + encodeURIComponent(index) + '/' + '_rank_eval';
|
|
56
72
|
} else {
|
|
57
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
58
|
-
path = '/' + '_rank_eval'
|
|
73
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
74
|
+
path = '/' + '_rank_eval';
|
|
59
75
|
}
|
|
60
76
|
|
|
61
77
|
// build request object
|
|
@@ -63,10 +79,10 @@ function rankEvalApi (params, options, callback) {
|
|
|
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)
|
|
85
|
+
return this.transport.request(request, options, callback);
|
|
70
86
|
}
|
|
71
87
|
|
|
72
|
-
module.exports = rankEvalApi
|
|
88
|
+
module.exports = rankEvalApi;
|
package/api/api/reindex.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,40 +27,61 @@
|
|
|
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
|
+
'refresh',
|
|
38
|
+
'timeout',
|
|
39
|
+
'wait_for_active_shards',
|
|
40
|
+
'wait_for_completion',
|
|
41
|
+
'requests_per_second',
|
|
42
|
+
'scroll',
|
|
43
|
+
'slices',
|
|
44
|
+
'max_docs',
|
|
45
|
+
'pretty',
|
|
46
|
+
'human',
|
|
47
|
+
'error_trace',
|
|
48
|
+
'source',
|
|
49
|
+
'filter_path',
|
|
50
|
+
];
|
|
51
|
+
const snakeCase = {
|
|
52
|
+
waitForActiveShards: 'wait_for_active_shards',
|
|
53
|
+
waitForCompletion: 'wait_for_completion',
|
|
54
|
+
requestsPerSecond: 'requests_per_second',
|
|
55
|
+
maxDocs: 'max_docs',
|
|
56
|
+
errorTrace: 'error_trace',
|
|
57
|
+
filterPath: 'filter_path',
|
|
58
|
+
};
|
|
39
59
|
|
|
40
|
-
function reindexApi
|
|
41
|
-
|
|
60
|
+
function reindexApi(params, options, callback) {
|
|
61
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
62
|
|
|
43
63
|
// check required parameters
|
|
44
64
|
if (params.body == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
46
|
-
return handleError(err, callback)
|
|
65
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
66
|
+
return handleError(err, callback);
|
|
47
67
|
}
|
|
48
68
|
|
|
49
|
-
let { method, body, ...querystring } = params
|
|
50
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
69
|
+
let { method, body, ...querystring } = params;
|
|
70
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
51
71
|
|
|
52
|
-
let path = ''
|
|
53
|
-
if (method == null) method = 'POST'
|
|
54
|
-
path = '/' + '_reindex'
|
|
72
|
+
let path = '';
|
|
73
|
+
if (method == null) method = 'POST';
|
|
74
|
+
path = '/' + '_reindex';
|
|
55
75
|
|
|
56
76
|
// build request object
|
|
57
77
|
const request = {
|
|
58
78
|
method,
|
|
59
79
|
path,
|
|
60
80
|
body: body || '',
|
|
61
|
-
querystring
|
|
62
|
-
}
|
|
81
|
+
querystring,
|
|
82
|
+
};
|
|
63
83
|
|
|
64
|
-
return this.transport.request(request, options, callback)
|
|
84
|
+
return this.transport.request(request, options, callback);
|
|
65
85
|
}
|
|
66
86
|
|
|
67
|
-
module.exports = reindexApi
|
|
87
|
+
module.exports = reindexApi;
|
|
@@ -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,57 @@
|
|
|
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
|
+
'requests_per_second',
|
|
38
|
+
'pretty',
|
|
39
|
+
'human',
|
|
40
|
+
'error_trace',
|
|
41
|
+
'source',
|
|
42
|
+
'filter_path',
|
|
43
|
+
];
|
|
44
|
+
const snakeCase = {
|
|
45
|
+
requestsPerSecond: 'requests_per_second',
|
|
46
|
+
errorTrace: 'error_trace',
|
|
47
|
+
filterPath: 'filter_path',
|
|
48
|
+
};
|
|
39
49
|
|
|
40
|
-
function reindexRethrottleApi
|
|
41
|
-
|
|
50
|
+
function reindexRethrottleApi(params, options, callback) {
|
|
51
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
52
|
|
|
43
53
|
// check required parameters
|
|
44
54
|
if (params.task_id == null && params.taskId == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId')
|
|
46
|
-
return handleError(err, callback)
|
|
55
|
+
const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId');
|
|
56
|
+
return handleError(err, callback);
|
|
47
57
|
}
|
|
48
58
|
if (params.requests_per_second == null && params.requestsPerSecond == null) {
|
|
49
|
-
const err = new this[kConfigurationError](
|
|
50
|
-
|
|
59
|
+
const err = new this[kConfigurationError](
|
|
60
|
+
'Missing required parameter: requests_per_second or requestsPerSecond'
|
|
61
|
+
);
|
|
62
|
+
return handleError(err, callback);
|
|
51
63
|
}
|
|
52
64
|
|
|
53
|
-
let { method, body, taskId, task_id, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
65
|
+
let { method, body, taskId, task_id, ...querystring } = params;
|
|
66
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
67
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (method == null) method = 'POST'
|
|
58
|
-
path = '/' + '_reindex' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle'
|
|
68
|
+
let path = '';
|
|
69
|
+
if (method == null) method = 'POST';
|
|
70
|
+
path = '/' + '_reindex' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle';
|
|
59
71
|
|
|
60
72
|
// build request object
|
|
61
73
|
const request = {
|
|
62
74
|
method,
|
|
63
75
|
path,
|
|
64
76
|
body: body || '',
|
|
65
|
-
querystring
|
|
66
|
-
}
|
|
77
|
+
querystring,
|
|
78
|
+
};
|
|
67
79
|
|
|
68
|
-
return this.transport.request(request, options, callback)
|
|
80
|
+
return this.transport.request(request, options, callback);
|
|
69
81
|
}
|
|
70
82
|
|
|
71
|
-
module.exports = reindexRethrottleApi
|
|
83
|
+
module.exports = reindexRethrottleApi;
|
|
@@ -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,28 +27,28 @@
|
|
|
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 renderSearchTemplateApi
|
|
41
|
-
|
|
39
|
+
function renderSearchTemplateApi(params, options, callback) {
|
|
40
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
41
|
|
|
43
|
-
let { method, body, id, ...querystring } = params
|
|
44
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
42
|
+
let { method, body, id, ...querystring } = params;
|
|
43
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
45
44
|
|
|
46
|
-
let path = ''
|
|
47
|
-
if (
|
|
48
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
49
|
-
path = '/' + '_render' + '/' + 'template' + '/' + encodeURIComponent(id)
|
|
45
|
+
let path = '';
|
|
46
|
+
if (id != null) {
|
|
47
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
48
|
+
path = '/' + '_render' + '/' + 'template' + '/' + encodeURIComponent(id);
|
|
50
49
|
} else {
|
|
51
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
52
|
-
path = '/' + '_render' + '/' + 'template'
|
|
50
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
51
|
+
path = '/' + '_render' + '/' + 'template';
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
// build request object
|
|
@@ -57,10 +56,10 @@ function renderSearchTemplateApi (params, options, callback) {
|
|
|
57
56
|
method,
|
|
58
57
|
path,
|
|
59
58
|
body: body || '',
|
|
60
|
-
querystring
|
|
61
|
-
}
|
|
59
|
+
querystring,
|
|
60
|
+
};
|
|
62
61
|
|
|
63
|
-
return this.transport.request(request, options, callback)
|
|
62
|
+
return this.transport.request(request, options, callback);
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
module.exports = renderSearchTemplateApi
|
|
65
|
+
module.exports = renderSearchTemplateApi;
|
|
@@ -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 scriptsPainlessExecuteApi
|
|
41
|
-
|
|
39
|
+
function scriptsPainlessExecuteApi(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 = body == null ? 'GET' : 'POST'
|
|
48
|
-
path = '/' + '_scripts' + '/' + 'painless' + '/' + '_execute'
|
|
45
|
+
let path = '';
|
|
46
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
47
|
+
path = '/' + '_scripts' + '/' + 'painless' + '/' + '_execute';
|
|
49
48
|
|
|
50
49
|
// build request object
|
|
51
50
|
const request = {
|
|
52
51
|
method,
|
|
53
52
|
path,
|
|
54
53
|
body: body || '',
|
|
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 = scriptsPainlessExecuteApi
|
|
60
|
+
module.exports = scriptsPainlessExecuteApi;
|
package/api/api/scroll.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,28 +27,42 @@
|
|
|
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
|
+
'scroll',
|
|
38
|
+
'scroll_id',
|
|
39
|
+
'rest_total_hits_as_int',
|
|
40
|
+
'pretty',
|
|
41
|
+
'human',
|
|
42
|
+
'error_trace',
|
|
43
|
+
'source',
|
|
44
|
+
'filter_path',
|
|
45
|
+
];
|
|
46
|
+
const snakeCase = {
|
|
47
|
+
scrollId: 'scroll_id',
|
|
48
|
+
restTotalHitsAsInt: 'rest_total_hits_as_int',
|
|
49
|
+
errorTrace: 'error_trace',
|
|
50
|
+
filterPath: 'filter_path',
|
|
51
|
+
};
|
|
39
52
|
|
|
40
|
-
function scrollApi
|
|
41
|
-
|
|
53
|
+
function scrollApi(params, options, callback) {
|
|
54
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
55
|
|
|
43
|
-
let { method, body, scrollId, scroll_id, ...querystring } = params
|
|
44
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
56
|
+
let { method, body, scrollId, scroll_id, ...querystring } = params;
|
|
57
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
45
58
|
|
|
46
|
-
let path = ''
|
|
59
|
+
let path = '';
|
|
47
60
|
if ((scroll_id || scrollId) != null) {
|
|
48
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
49
|
-
path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId)
|
|
61
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
62
|
+
path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId);
|
|
50
63
|
} else {
|
|
51
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
52
|
-
path = '/' + '_search' + '/' + 'scroll'
|
|
64
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
65
|
+
path = '/' + '_search' + '/' + 'scroll';
|
|
53
66
|
}
|
|
54
67
|
|
|
55
68
|
// build request object
|
|
@@ -57,10 +70,10 @@ function scrollApi (params, options, callback) {
|
|
|
57
70
|
method,
|
|
58
71
|
path,
|
|
59
72
|
body: body || '',
|
|
60
|
-
querystring
|
|
61
|
-
}
|
|
73
|
+
querystring,
|
|
74
|
+
};
|
|
62
75
|
|
|
63
|
-
return this.transport.request(request, options, callback)
|
|
76
|
+
return this.transport.request(request, options, callback);
|
|
64
77
|
}
|
|
65
78
|
|
|
66
|
-
module.exports = scrollApi
|
|
79
|
+
module.exports = scrollApi;
|