@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/count.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,37 +27,68 @@
|
|
|
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
|
+
'ignore_throttled',
|
|
39
|
+
'allow_no_indices',
|
|
40
|
+
'expand_wildcards',
|
|
41
|
+
'min_score',
|
|
42
|
+
'preference',
|
|
43
|
+
'routing',
|
|
44
|
+
'q',
|
|
45
|
+
'analyzer',
|
|
46
|
+
'analyze_wildcard',
|
|
47
|
+
'default_operator',
|
|
48
|
+
'df',
|
|
49
|
+
'lenient',
|
|
50
|
+
'terminate_after',
|
|
51
|
+
'pretty',
|
|
52
|
+
'human',
|
|
53
|
+
'error_trace',
|
|
54
|
+
'source',
|
|
55
|
+
'filter_path',
|
|
56
|
+
];
|
|
57
|
+
const snakeCase = {
|
|
58
|
+
ignoreUnavailable: 'ignore_unavailable',
|
|
59
|
+
ignoreThrottled: 'ignore_throttled',
|
|
60
|
+
allowNoIndices: 'allow_no_indices',
|
|
61
|
+
expandWildcards: 'expand_wildcards',
|
|
62
|
+
minScore: 'min_score',
|
|
63
|
+
analyzeWildcard: 'analyze_wildcard',
|
|
64
|
+
defaultOperator: 'default_operator',
|
|
65
|
+
terminateAfter: 'terminate_after',
|
|
66
|
+
errorTrace: 'error_trace',
|
|
67
|
+
filterPath: 'filter_path',
|
|
68
|
+
};
|
|
39
69
|
|
|
40
|
-
function countApi
|
|
41
|
-
|
|
70
|
+
function countApi(params, options, callback) {
|
|
71
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
72
|
|
|
43
73
|
// 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)
|
|
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);
|
|
47
77
|
}
|
|
48
78
|
|
|
49
|
-
let { method, body, index, type, ...querystring } = params
|
|
50
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
79
|
+
let { method, body, index, type, ...querystring } = params;
|
|
80
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
51
81
|
|
|
52
|
-
let path = ''
|
|
53
|
-
if (
|
|
54
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
55
|
-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count'
|
|
56
|
-
} else if (
|
|
57
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
58
|
-
path = '/' + encodeURIComponent(index) + '/' + '_count'
|
|
82
|
+
let path = '';
|
|
83
|
+
if (index != null && type != null) {
|
|
84
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
85
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count';
|
|
86
|
+
} else if (index != null) {
|
|
87
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
88
|
+
path = '/' + encodeURIComponent(index) + '/' + '_count';
|
|
59
89
|
} else {
|
|
60
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
61
|
-
path = '/' + '_count'
|
|
90
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
91
|
+
path = '/' + '_count';
|
|
62
92
|
}
|
|
63
93
|
|
|
64
94
|
// build request object
|
|
@@ -66,10 +96,10 @@ function countApi (params, options, callback) {
|
|
|
66
96
|
method,
|
|
67
97
|
path,
|
|
68
98
|
body: body || '',
|
|
69
|
-
querystring
|
|
70
|
-
}
|
|
99
|
+
querystring,
|
|
100
|
+
};
|
|
71
101
|
|
|
72
|
-
return this.transport.request(request, options, callback)
|
|
102
|
+
return this.transport.request(request, options, callback);
|
|
73
103
|
}
|
|
74
104
|
|
|
75
|
-
module.exports = countApi
|
|
105
|
+
module.exports = countApi;
|
package/api/api/create.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,42 +27,68 @@
|
|
|
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
|
+
'refresh',
|
|
39
|
+
'routing',
|
|
40
|
+
'timeout',
|
|
41
|
+
'version',
|
|
42
|
+
'version_type',
|
|
43
|
+
'pipeline',
|
|
44
|
+
'pretty',
|
|
45
|
+
'human',
|
|
46
|
+
'error_trace',
|
|
47
|
+
'source',
|
|
48
|
+
'filter_path',
|
|
49
|
+
];
|
|
50
|
+
const snakeCase = {
|
|
51
|
+
waitForActiveShards: 'wait_for_active_shards',
|
|
52
|
+
versionType: 'version_type',
|
|
53
|
+
errorTrace: 'error_trace',
|
|
54
|
+
filterPath: 'filter_path',
|
|
55
|
+
};
|
|
39
56
|
|
|
40
|
-
function createApi
|
|
41
|
-
|
|
57
|
+
function createApi(params, options, callback) {
|
|
58
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
59
|
|
|
43
60
|
// check required parameters
|
|
44
61
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
62
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
63
|
+
return handleError(err, callback);
|
|
47
64
|
}
|
|
48
65
|
if (params.index == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
50
|
-
return handleError(err, callback)
|
|
66
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
67
|
+
return handleError(err, callback);
|
|
51
68
|
}
|
|
52
69
|
if (params.body == null) {
|
|
53
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
54
|
-
return handleError(err, callback)
|
|
70
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
71
|
+
return handleError(err, callback);
|
|
55
72
|
}
|
|
56
73
|
|
|
57
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
58
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
74
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
75
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
59
76
|
|
|
60
|
-
let path = ''
|
|
61
|
-
if (
|
|
62
|
-
if (method == null) method = 'PUT'
|
|
63
|
-
path =
|
|
77
|
+
let path = '';
|
|
78
|
+
if (index != null && type != null && id != null) {
|
|
79
|
+
if (method == null) method = 'PUT';
|
|
80
|
+
path =
|
|
81
|
+
'/' +
|
|
82
|
+
encodeURIComponent(index) +
|
|
83
|
+
'/' +
|
|
84
|
+
encodeURIComponent(type) +
|
|
85
|
+
'/' +
|
|
86
|
+
encodeURIComponent(id) +
|
|
87
|
+
'/' +
|
|
88
|
+
'_create';
|
|
64
89
|
} else {
|
|
65
|
-
if (method == null) method = 'PUT'
|
|
66
|
-
path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id)
|
|
90
|
+
if (method == null) method = 'PUT';
|
|
91
|
+
path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id);
|
|
67
92
|
}
|
|
68
93
|
|
|
69
94
|
// build request object
|
|
@@ -71,10 +96,10 @@ function createApi (params, options, callback) {
|
|
|
71
96
|
method,
|
|
72
97
|
path,
|
|
73
98
|
body: body || '',
|
|
74
|
-
querystring
|
|
75
|
-
}
|
|
99
|
+
querystring,
|
|
100
|
+
};
|
|
76
101
|
|
|
77
|
-
return this.transport.request(request, options, callback)
|
|
102
|
+
return this.transport.request(request, options, callback);
|
|
78
103
|
}
|
|
79
104
|
|
|
80
|
-
module.exports = createApi
|
|
105
|
+
module.exports = createApi;
|
|
@@ -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,99 +27,143 @@
|
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
36
|
+
const acceptedQuerystring = [
|
|
37
|
+
'accept_data_loss',
|
|
38
|
+
'timeout',
|
|
39
|
+
'cluster_manager_timeout',
|
|
40
|
+
'master_timeout',
|
|
41
|
+
'pretty',
|
|
42
|
+
'human',
|
|
43
|
+
'error_trace',
|
|
44
|
+
'source',
|
|
45
|
+
'filter_path',
|
|
46
|
+
];
|
|
47
|
+
const snakeCase = {
|
|
48
|
+
acceptDataLoss: 'accept_data_loss',
|
|
49
|
+
clusterManagerTimeout: 'cluster_manager_timeout',
|
|
50
|
+
masterTimeout: 'master_timeout',
|
|
51
|
+
errorTrace: 'error_trace',
|
|
52
|
+
filterPath: 'filter_path',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
function DanglingIndicesApi(transport, ConfigurationError) {
|
|
56
|
+
this.transport = transport;
|
|
57
|
+
this[kConfigurationError] = ConfigurationError;
|
|
43
58
|
}
|
|
44
59
|
|
|
45
|
-
DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDeleteDanglingIndexApi
|
|
46
|
-
|
|
60
|
+
DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDeleteDanglingIndexApi(
|
|
61
|
+
params,
|
|
62
|
+
options,
|
|
63
|
+
callback
|
|
64
|
+
) {
|
|
65
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
47
66
|
|
|
48
67
|
// check required parameters
|
|
49
68
|
if (params.index_uuid == null && params.indexUuid == null) {
|
|
50
|
-
const err = new this[kConfigurationError](
|
|
51
|
-
|
|
69
|
+
const err = new this[kConfigurationError](
|
|
70
|
+
'Missing required parameter: index_uuid or indexUuid'
|
|
71
|
+
);
|
|
72
|
+
return handleError(err, callback);
|
|
52
73
|
}
|
|
53
74
|
|
|
54
|
-
let { method, body, indexUuid, index_uuid, ...querystring } = params
|
|
55
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
75
|
+
let { method, body, indexUuid, index_uuid, ...querystring } = params;
|
|
76
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
56
77
|
|
|
57
|
-
let path = ''
|
|
58
|
-
if (method == null) method = 'DELETE'
|
|
59
|
-
path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid)
|
|
78
|
+
let path = '';
|
|
79
|
+
if (method == null) method = 'DELETE';
|
|
80
|
+
path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid);
|
|
60
81
|
|
|
61
82
|
// build request object
|
|
62
83
|
const request = {
|
|
63
84
|
method,
|
|
64
85
|
path,
|
|
65
86
|
body: body || '',
|
|
66
|
-
querystring
|
|
67
|
-
}
|
|
87
|
+
querystring,
|
|
88
|
+
};
|
|
68
89
|
|
|
69
|
-
return this.transport.request(request, options, callback)
|
|
70
|
-
}
|
|
90
|
+
return this.transport.request(request, options, callback);
|
|
91
|
+
};
|
|
71
92
|
|
|
72
|
-
DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImportDanglingIndexApi
|
|
73
|
-
|
|
93
|
+
DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImportDanglingIndexApi(
|
|
94
|
+
params,
|
|
95
|
+
options,
|
|
96
|
+
callback
|
|
97
|
+
) {
|
|
98
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
74
99
|
|
|
75
100
|
// check required parameters
|
|
76
101
|
if (params.index_uuid == null && params.indexUuid == null) {
|
|
77
|
-
const err = new this[kConfigurationError](
|
|
78
|
-
|
|
102
|
+
const err = new this[kConfigurationError](
|
|
103
|
+
'Missing required parameter: index_uuid or indexUuid'
|
|
104
|
+
);
|
|
105
|
+
return handleError(err, callback);
|
|
79
106
|
}
|
|
80
107
|
|
|
81
|
-
let { method, body, indexUuid, index_uuid, ...querystring } = params
|
|
82
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
108
|
+
let { method, body, indexUuid, index_uuid, ...querystring } = params;
|
|
109
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
83
110
|
|
|
84
|
-
let path = ''
|
|
85
|
-
if (method == null) method = 'POST'
|
|
86
|
-
path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid)
|
|
111
|
+
let path = '';
|
|
112
|
+
if (method == null) method = 'POST';
|
|
113
|
+
path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid);
|
|
87
114
|
|
|
88
115
|
// build request object
|
|
89
116
|
const request = {
|
|
90
117
|
method,
|
|
91
118
|
path,
|
|
92
119
|
body: body || '',
|
|
93
|
-
querystring
|
|
94
|
-
}
|
|
120
|
+
querystring,
|
|
121
|
+
};
|
|
95
122
|
|
|
96
|
-
return this.transport.request(request, options, callback)
|
|
97
|
-
}
|
|
123
|
+
return this.transport.request(request, options, callback);
|
|
124
|
+
};
|
|
98
125
|
|
|
99
|
-
DanglingIndicesApi.prototype.listDanglingIndices = function danglingIndicesListDanglingIndicesApi
|
|
100
|
-
|
|
126
|
+
DanglingIndicesApi.prototype.listDanglingIndices = function danglingIndicesListDanglingIndicesApi(
|
|
127
|
+
params,
|
|
128
|
+
options,
|
|
129
|
+
callback
|
|
130
|
+
) {
|
|
131
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
101
132
|
|
|
102
|
-
let { method, body, ...querystring } = params
|
|
103
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
133
|
+
let { method, body, ...querystring } = params;
|
|
134
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
104
135
|
|
|
105
|
-
let path = ''
|
|
106
|
-
if (method == null) method = 'GET'
|
|
107
|
-
path = '/' + '_dangling'
|
|
136
|
+
let path = '';
|
|
137
|
+
if (method == null) method = 'GET';
|
|
138
|
+
path = '/' + '_dangling';
|
|
108
139
|
|
|
109
140
|
// build request object
|
|
110
141
|
const request = {
|
|
111
142
|
method,
|
|
112
143
|
path,
|
|
113
144
|
body: null,
|
|
114
|
-
querystring
|
|
115
|
-
}
|
|
145
|
+
querystring,
|
|
146
|
+
};
|
|
116
147
|
|
|
117
|
-
return this.transport.request(request, options, callback)
|
|
118
|
-
}
|
|
148
|
+
return this.transport.request(request, options, callback);
|
|
149
|
+
};
|
|
119
150
|
|
|
120
151
|
Object.defineProperties(DanglingIndicesApi.prototype, {
|
|
121
|
-
delete_dangling_index: {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
152
|
+
delete_dangling_index: {
|
|
153
|
+
get() {
|
|
154
|
+
return this.deleteDanglingIndex;
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
import_dangling_index: {
|
|
158
|
+
get() {
|
|
159
|
+
return this.importDanglingIndex;
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
list_dangling_indices: {
|
|
163
|
+
get() {
|
|
164
|
+
return this.listDanglingIndices;
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
module.exports = DanglingIndicesApi;
|
package/api/api/delete.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,65 @@
|
|
|
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
|
+
'refresh',
|
|
39
|
+
'routing',
|
|
40
|
+
'timeout',
|
|
41
|
+
'if_seq_no',
|
|
42
|
+
'if_primary_term',
|
|
43
|
+
'version',
|
|
44
|
+
'version_type',
|
|
45
|
+
'pretty',
|
|
46
|
+
'human',
|
|
47
|
+
'error_trace',
|
|
48
|
+
'source',
|
|
49
|
+
'filter_path',
|
|
50
|
+
];
|
|
51
|
+
const snakeCase = {
|
|
52
|
+
waitForActiveShards: 'wait_for_active_shards',
|
|
53
|
+
ifSeqNo: 'if_seq_no',
|
|
54
|
+
ifPrimaryTerm: 'if_primary_term',
|
|
55
|
+
versionType: 'version_type',
|
|
56
|
+
errorTrace: 'error_trace',
|
|
57
|
+
filterPath: 'filter_path',
|
|
58
|
+
};
|
|
39
59
|
|
|
40
|
-
function deleteApi
|
|
41
|
-
|
|
60
|
+
function deleteApi(params, options, callback) {
|
|
61
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
62
|
|
|
43
63
|
// check required parameters
|
|
44
64
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
65
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
66
|
+
return handleError(err, callback);
|
|
47
67
|
}
|
|
48
68
|
if (params.index == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
50
|
-
return handleError(err, callback)
|
|
69
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
70
|
+
return handleError(err, callback);
|
|
51
71
|
}
|
|
52
72
|
|
|
53
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
73
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
74
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
75
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (
|
|
58
|
-
if (method == null) method = 'DELETE'
|
|
59
|
-
path =
|
|
76
|
+
let path = '';
|
|
77
|
+
if (index != null && type != null && id != null) {
|
|
78
|
+
if (method == null) method = 'DELETE';
|
|
79
|
+
path =
|
|
80
|
+
'/' +
|
|
81
|
+
encodeURIComponent(index) +
|
|
82
|
+
'/' +
|
|
83
|
+
encodeURIComponent(type) +
|
|
84
|
+
'/' +
|
|
85
|
+
encodeURIComponent(id);
|
|
60
86
|
} else {
|
|
61
|
-
if (method == null) method = 'DELETE'
|
|
62
|
-
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
|
|
87
|
+
if (method == null) method = 'DELETE';
|
|
88
|
+
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id);
|
|
63
89
|
}
|
|
64
90
|
|
|
65
91
|
// build request object
|
|
@@ -67,10 +93,10 @@ function deleteApi (params, options, callback) {
|
|
|
67
93
|
method,
|
|
68
94
|
path,
|
|
69
95
|
body: body || '',
|
|
70
|
-
querystring
|
|
71
|
-
}
|
|
96
|
+
querystring,
|
|
97
|
+
};
|
|
72
98
|
|
|
73
|
-
return this.transport.request(request, options, callback)
|
|
99
|
+
return this.transport.request(request, options, callback);
|
|
74
100
|
}
|
|
75
101
|
|
|
76
|
-
module.exports = deleteApi
|
|
102
|
+
module.exports = deleteApi;
|