@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,44 +27,107 @@
|
|
|
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
|
+
'analyzer',
|
|
38
|
+
'analyze_wildcard',
|
|
39
|
+
'default_operator',
|
|
40
|
+
'df',
|
|
41
|
+
'from',
|
|
42
|
+
'ignore_unavailable',
|
|
43
|
+
'allow_no_indices',
|
|
44
|
+
'conflicts',
|
|
45
|
+
'expand_wildcards',
|
|
46
|
+
'lenient',
|
|
47
|
+
'preference',
|
|
48
|
+
'q',
|
|
49
|
+
'routing',
|
|
50
|
+
'scroll',
|
|
51
|
+
'search_type',
|
|
52
|
+
'search_timeout',
|
|
53
|
+
'size',
|
|
54
|
+
'max_docs',
|
|
55
|
+
'sort',
|
|
56
|
+
'_source',
|
|
57
|
+
'_source_excludes',
|
|
58
|
+
'_source_exclude',
|
|
59
|
+
'_source_includes',
|
|
60
|
+
'_source_include',
|
|
61
|
+
'terminate_after',
|
|
62
|
+
'stats',
|
|
63
|
+
'version',
|
|
64
|
+
'request_cache',
|
|
65
|
+
'refresh',
|
|
66
|
+
'timeout',
|
|
67
|
+
'wait_for_active_shards',
|
|
68
|
+
'scroll_size',
|
|
69
|
+
'wait_for_completion',
|
|
70
|
+
'requests_per_second',
|
|
71
|
+
'slices',
|
|
72
|
+
'pretty',
|
|
73
|
+
'human',
|
|
74
|
+
'error_trace',
|
|
75
|
+
'source',
|
|
76
|
+
'filter_path',
|
|
77
|
+
];
|
|
78
|
+
const snakeCase = {
|
|
79
|
+
analyzeWildcard: 'analyze_wildcard',
|
|
80
|
+
defaultOperator: 'default_operator',
|
|
81
|
+
ignoreUnavailable: 'ignore_unavailable',
|
|
82
|
+
allowNoIndices: 'allow_no_indices',
|
|
83
|
+
expandWildcards: 'expand_wildcards',
|
|
84
|
+
searchType: 'search_type',
|
|
85
|
+
searchTimeout: 'search_timeout',
|
|
86
|
+
maxDocs: 'max_docs',
|
|
87
|
+
_sourceExcludes: '_source_excludes',
|
|
88
|
+
_sourceExclude: '_source_exclude',
|
|
89
|
+
_sourceIncludes: '_source_includes',
|
|
90
|
+
_sourceInclude: '_source_include',
|
|
91
|
+
terminateAfter: 'terminate_after',
|
|
92
|
+
requestCache: 'request_cache',
|
|
93
|
+
waitForActiveShards: 'wait_for_active_shards',
|
|
94
|
+
scrollSize: 'scroll_size',
|
|
95
|
+
waitForCompletion: 'wait_for_completion',
|
|
96
|
+
requestsPerSecond: 'requests_per_second',
|
|
97
|
+
errorTrace: 'error_trace',
|
|
98
|
+
filterPath: 'filter_path',
|
|
99
|
+
};
|
|
39
100
|
|
|
40
|
-
function deleteByQueryApi
|
|
41
|
-
|
|
101
|
+
function deleteByQueryApi(params, options, callback) {
|
|
102
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
103
|
|
|
43
104
|
// check required parameters
|
|
44
105
|
if (params.index == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
46
|
-
return handleError(err, callback)
|
|
106
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
107
|
+
return handleError(err, callback);
|
|
47
108
|
}
|
|
48
109
|
if (params.body == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
50
|
-
return handleError(err, callback)
|
|
110
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
111
|
+
return handleError(err, callback);
|
|
51
112
|
}
|
|
52
113
|
|
|
53
114
|
// check required url components
|
|
54
|
-
if (params.type != null &&
|
|
55
|
-
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
|
56
|
-
return handleError(err, callback)
|
|
115
|
+
if (params.type != null && params.index == null) {
|
|
116
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index');
|
|
117
|
+
return handleError(err, callback);
|
|
57
118
|
}
|
|
58
119
|
|
|
59
|
-
let { method, body, index, type, ...querystring } = params
|
|
60
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
120
|
+
let { method, body, index, type, ...querystring } = params;
|
|
121
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
61
122
|
|
|
62
|
-
let path = ''
|
|
63
|
-
if (
|
|
64
|
-
if (method == null) method = 'POST'
|
|
65
|
-
path =
|
|
123
|
+
let path = '';
|
|
124
|
+
if (index != null && type != null) {
|
|
125
|
+
if (method == null) method = 'POST';
|
|
126
|
+
path =
|
|
127
|
+
'/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query';
|
|
66
128
|
} else {
|
|
67
|
-
if (method == null) method = 'POST'
|
|
68
|
-
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
|
|
129
|
+
if (method == null) method = 'POST';
|
|
130
|
+
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query';
|
|
69
131
|
}
|
|
70
132
|
|
|
71
133
|
// build request object
|
|
@@ -73,10 +135,10 @@ function deleteByQueryApi (params, options, callback) {
|
|
|
73
135
|
method,
|
|
74
136
|
path,
|
|
75
137
|
body: body || '',
|
|
76
|
-
querystring
|
|
77
|
-
}
|
|
138
|
+
querystring,
|
|
139
|
+
};
|
|
78
140
|
|
|
79
|
-
return this.transport.request(request, options, callback)
|
|
141
|
+
return this.transport.request(request, options, callback);
|
|
80
142
|
}
|
|
81
143
|
|
|
82
|
-
module.exports = deleteByQueryApi
|
|
144
|
+
module.exports = deleteByQueryApi;
|
|
@@ -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,58 @@
|
|
|
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 deleteByQueryRethrottleApi
|
|
41
|
-
|
|
50
|
+
function deleteByQueryRethrottleApi(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 =
|
|
68
|
+
let path = '';
|
|
69
|
+
if (method == null) method = 'POST';
|
|
70
|
+
path =
|
|
71
|
+
'/' + '_delete_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle';
|
|
59
72
|
|
|
60
73
|
// build request object
|
|
61
74
|
const request = {
|
|
62
75
|
method,
|
|
63
76
|
path,
|
|
64
77
|
body: body || '',
|
|
65
|
-
querystring
|
|
66
|
-
}
|
|
78
|
+
querystring,
|
|
79
|
+
};
|
|
67
80
|
|
|
68
|
-
return this.transport.request(request, options, callback)
|
|
81
|
+
return this.transport.request(request, options, callback);
|
|
69
82
|
}
|
|
70
83
|
|
|
71
|
-
module.exports = deleteByQueryRethrottleApi
|
|
84
|
+
module.exports = deleteByQueryRethrottleApi;
|
package/api/api/delete_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,40 +27,54 @@
|
|
|
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
|
+
'timeout',
|
|
38
|
+
'cluster_manager_timeout',
|
|
39
|
+
'master_timeout',
|
|
40
|
+
'pretty',
|
|
41
|
+
'human',
|
|
42
|
+
'error_trace',
|
|
43
|
+
'source',
|
|
44
|
+
'filter_path',
|
|
45
|
+
];
|
|
46
|
+
const snakeCase = {
|
|
47
|
+
clusterManagerTimeout: 'cluster_manager_timeout',
|
|
48
|
+
masterTimeout: 'master_timeout',
|
|
49
|
+
errorTrace: 'error_trace',
|
|
50
|
+
filterPath: 'filter_path',
|
|
51
|
+
};
|
|
39
52
|
|
|
40
|
-
function deleteScriptApi
|
|
41
|
-
|
|
53
|
+
function deleteScriptApi(params, options, callback) {
|
|
54
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
55
|
|
|
43
56
|
// check required parameters
|
|
44
57
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
58
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
59
|
+
return handleError(err, callback);
|
|
47
60
|
}
|
|
48
61
|
|
|
49
|
-
let { method, body, id, ...querystring } = params
|
|
50
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
62
|
+
let { method, body, id, ...querystring } = params;
|
|
63
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
51
64
|
|
|
52
|
-
let path = ''
|
|
53
|
-
if (method == null) method = 'DELETE'
|
|
54
|
-
path = '/' + '_scripts' + '/' + encodeURIComponent(id)
|
|
65
|
+
let path = '';
|
|
66
|
+
if (method == null) method = 'DELETE';
|
|
67
|
+
path = '/' + '_scripts' + '/' + encodeURIComponent(id);
|
|
55
68
|
|
|
56
69
|
// build request object
|
|
57
70
|
const request = {
|
|
58
71
|
method,
|
|
59
72
|
path,
|
|
60
73
|
body: body || '',
|
|
61
|
-
querystring
|
|
62
|
-
}
|
|
74
|
+
querystring,
|
|
75
|
+
};
|
|
63
76
|
|
|
64
|
-
return this.transport.request(request, options, callback)
|
|
77
|
+
return this.transport.request(request, options, callback);
|
|
65
78
|
}
|
|
66
79
|
|
|
67
|
-
module.exports = deleteScriptApi
|
|
80
|
+
module.exports = deleteScriptApi;
|
package/api/api/exists.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
|
+
'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
|
+
'version',
|
|
48
|
+
'version_type',
|
|
49
|
+
'pretty',
|
|
50
|
+
'human',
|
|
51
|
+
'error_trace',
|
|
52
|
+
'source',
|
|
53
|
+
'filter_path',
|
|
54
|
+
];
|
|
55
|
+
const snakeCase = {
|
|
56
|
+
storedFields: 'stored_fields',
|
|
57
|
+
_sourceExcludes: '_source_excludes',
|
|
58
|
+
_sourceExclude: '_source_exclude',
|
|
59
|
+
_sourceIncludes: '_source_includes',
|
|
60
|
+
_sourceInclude: '_source_include',
|
|
61
|
+
versionType: 'version_type',
|
|
62
|
+
errorTrace: 'error_trace',
|
|
63
|
+
filterPath: 'filter_path',
|
|
64
|
+
};
|
|
39
65
|
|
|
40
|
-
function existsApi
|
|
41
|
-
|
|
66
|
+
function existsApi(params, options, callback) {
|
|
67
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
68
|
|
|
43
69
|
// check required parameters
|
|
44
70
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
71
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
72
|
+
return handleError(err, callback);
|
|
47
73
|
}
|
|
48
74
|
if (params.index == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
50
|
-
return handleError(err, callback)
|
|
75
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
76
|
+
return handleError(err, callback);
|
|
51
77
|
}
|
|
52
78
|
|
|
53
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
79
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
80
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
81
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (
|
|
58
|
-
if (method == null) method = 'HEAD'
|
|
59
|
-
path =
|
|
82
|
+
let path = '';
|
|
83
|
+
if (index != null && type != null && id != null) {
|
|
84
|
+
if (method == null) method = 'HEAD';
|
|
85
|
+
path =
|
|
86
|
+
'/' +
|
|
87
|
+
encodeURIComponent(index) +
|
|
88
|
+
'/' +
|
|
89
|
+
encodeURIComponent(type) +
|
|
90
|
+
'/' +
|
|
91
|
+
encodeURIComponent(id);
|
|
60
92
|
} else {
|
|
61
|
-
if (method == null) method = 'HEAD'
|
|
62
|
-
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
|
|
93
|
+
if (method == null) method = 'HEAD';
|
|
94
|
+
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id);
|
|
63
95
|
}
|
|
64
96
|
|
|
65
97
|
// build request object
|
|
@@ -67,10 +99,10 @@ function existsApi (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 = existsApi
|
|
108
|
+
module.exports = existsApi;
|
package/api/api/exists_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,47 +27,80 @@
|
|
|
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 existsSourceApi
|
|
41
|
-
|
|
64
|
+
function existsSourceApi(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
77
|
// check required url components
|
|
54
78
|
if (params.id != null && (params.type == null || params.index == null)) {
|
|
55
|
-
const err = new this[kConfigurationError]('Missing required parameter of the url: type, index')
|
|
56
|
-
return handleError(err, callback)
|
|
57
|
-
} else if (params.type != null &&
|
|
58
|
-
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
|
59
|
-
return handleError(err, callback)
|
|
79
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: type, index');
|
|
80
|
+
return handleError(err, callback);
|
|
81
|
+
} else if (params.type != null && params.index == null) {
|
|
82
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index');
|
|
83
|
+
return handleError(err, callback);
|
|
60
84
|
}
|
|
61
85
|
|
|
62
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
63
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
86
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
87
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
64
88
|
|
|
65
|
-
let path = ''
|
|
66
|
-
if (
|
|
67
|
-
if (method == null) method = 'HEAD'
|
|
68
|
-
path =
|
|
89
|
+
let path = '';
|
|
90
|
+
if (index != null && type != null && id != null) {
|
|
91
|
+
if (method == null) method = 'HEAD';
|
|
92
|
+
path =
|
|
93
|
+
'/' +
|
|
94
|
+
encodeURIComponent(index) +
|
|
95
|
+
'/' +
|
|
96
|
+
encodeURIComponent(type) +
|
|
97
|
+
'/' +
|
|
98
|
+
encodeURIComponent(id) +
|
|
99
|
+
'/' +
|
|
100
|
+
'_source';
|
|
69
101
|
} else {
|
|
70
|
-
if (method == null) method = 'HEAD'
|
|
71
|
-
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
|
|
102
|
+
if (method == null) method = 'HEAD';
|
|
103
|
+
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id);
|
|
72
104
|
}
|
|
73
105
|
|
|
74
106
|
// build request object
|
|
@@ -76,10 +108,10 @@ function existsSourceApi (params, options, callback) {
|
|
|
76
108
|
method,
|
|
77
109
|
path,
|
|
78
110
|
body: null,
|
|
79
|
-
querystring
|
|
80
|
-
}
|
|
111
|
+
querystring,
|
|
112
|
+
};
|
|
81
113
|
|
|
82
|
-
return this.transport.request(request, options, callback)
|
|
114
|
+
return this.transport.request(request, options, callback);
|
|
83
115
|
}
|
|
84
116
|
|
|
85
|
-
module.exports = existsSourceApi
|
|
117
|
+
module.exports = existsSourceApi;
|