@opensearch-project/opensearch 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.eslintrc.json +26 -0
- package/.prettierrc.json +5 -0
- package/.whitesource +15 -0
- package/ADMINS.md +18 -11
- package/COMPATIBILITY.md +24 -0
- package/DEVELOPER_GUIDE.md +22 -5
- package/MAINTAINERS.md +23 -18
- package/README.md +100 -101
- package/RELEASING.md +3 -3
- package/SECURITY.md +1 -1
- package/api/api/bulk.js +53 -26
- package/api/api/cat.js +354 -264
- package/api/api/clear_scroll.js +17 -17
- package/api/api/cluster.js +366 -219
- package/api/api/count.js +55 -24
- package/api/api/create.js +50 -24
- package/api/api/dangling_indices.js +95 -51
- package/api/api/delete.js +49 -22
- package/api/api/delete_by_query.js +88 -25
- package/api/api/delete_by_query_rethrottle.js +33 -19
- package/api/api/delete_script.js +31 -17
- package/api/api/exists.js +55 -22
- package/api/api/exists_source.js +60 -27
- package/api/api/explain.js +60 -22
- package/api/api/features.js +56 -35
- package/api/api/field_caps.js +36 -18
- package/api/api/get.js +55 -22
- package/api/api/get_script.js +30 -17
- package/api/api/get_script_context.js +15 -15
- package/api/api/get_script_languages.js +15 -15
- package/api/api/get_source.js +55 -22
- package/api/api/index.js +60 -28
- package/api/api/indices.js +1068 -857
- package/api/api/info.js +15 -15
- package/api/api/ingest.js +132 -96
- package/api/api/mget.js +50 -26
- package/api/api/msearch.js +49 -26
- package/api/api/msearch_template.js +53 -26
- package/api/api/mtermvectors.js +48 -24
- package/api/api/nodes.js +281 -154
- package/api/api/ping.js +15 -15
- package/api/api/put_script.js +40 -25
- package/api/api/rank_eval.js +37 -20
- package/api/api/reindex.js +38 -17
- package/api/api/reindex_rethrottle.js +32 -19
- package/api/api/render_search_template.js +18 -18
- package/api/api/scripts_painless_execute.js +15 -15
- package/api/api/scroll.js +31 -17
- package/api/api/search.js +108 -24
- package/api/api/search_shards.js +36 -18
- package/api/api/search_template.js +64 -26
- package/api/api/shutdown.js +66 -54
- package/api/api/snapshot.js +347 -224
- package/api/api/tasks.js +65 -46
- package/api/api/terms_enum.js +17 -17
- package/api/api/termvectors.js +57 -26
- package/api/api/update.js +64 -24
- package/api/api/update_by_query.js +89 -23
- package/api/api/update_by_query_rethrottle.js +33 -19
- package/api/index.js +267 -179
- package/api/new.d.ts +2042 -529
- package/api/opensearch_dashboards.d.ts +239 -236
- package/api/requestParams.d.ts +301 -69
- package/api/types.d.ts +6204 -5719
- package/api/utils.js +22 -22
- package/codecov.yml +2 -2
- package/index.d.ts +4776 -935
- package/index.js +152 -140
- package/index.mjs +9 -9
- package/lib/Connection.d.ts +37 -26
- package/lib/Connection.js +163 -168
- package/lib/Helpers.d.ts +103 -64
- package/lib/Helpers.js +398 -371
- package/lib/Serializer.d.ts +2 -2
- package/lib/Serializer.js +39 -39
- package/lib/Transport.d.ts +30 -12
- package/lib/Transport.js +375 -336
- package/lib/errors.d.ts +25 -7
- package/lib/errors.js +75 -71
- package/lib/pool/BaseConnectionPool.js +100 -97
- package/lib/pool/CloudConnectionPool.js +16 -16
- package/lib/pool/ConnectionPool.js +105 -105
- package/lib/pool/index.d.ts +8 -6
- package/lib/pool/index.js +6 -6
- package/package.json +13 -8
package/api/api/count.js
CHANGED
|
@@ -28,37 +28,68 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = [
|
|
38
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'ignore_unavailable',
|
|
39
|
+
'ignore_throttled',
|
|
40
|
+
'allow_no_indices',
|
|
41
|
+
'expand_wildcards',
|
|
42
|
+
'min_score',
|
|
43
|
+
'preference',
|
|
44
|
+
'routing',
|
|
45
|
+
'q',
|
|
46
|
+
'analyzer',
|
|
47
|
+
'analyze_wildcard',
|
|
48
|
+
'default_operator',
|
|
49
|
+
'df',
|
|
50
|
+
'lenient',
|
|
51
|
+
'terminate_after',
|
|
52
|
+
'pretty',
|
|
53
|
+
'human',
|
|
54
|
+
'error_trace',
|
|
55
|
+
'source',
|
|
56
|
+
'filter_path',
|
|
57
|
+
];
|
|
58
|
+
const snakeCase = {
|
|
59
|
+
ignoreUnavailable: 'ignore_unavailable',
|
|
60
|
+
ignoreThrottled: 'ignore_throttled',
|
|
61
|
+
allowNoIndices: 'allow_no_indices',
|
|
62
|
+
expandWildcards: 'expand_wildcards',
|
|
63
|
+
minScore: 'min_score',
|
|
64
|
+
analyzeWildcard: 'analyze_wildcard',
|
|
65
|
+
defaultOperator: 'default_operator',
|
|
66
|
+
terminateAfter: 'terminate_after',
|
|
67
|
+
errorTrace: 'error_trace',
|
|
68
|
+
filterPath: 'filter_path',
|
|
69
|
+
};
|
|
39
70
|
|
|
40
|
-
function countApi
|
|
41
|
-
|
|
71
|
+
function countApi(params, options, callback) {
|
|
72
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
73
|
|
|
43
74
|
// 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)
|
|
75
|
+
if (params.type != null && params.index == null) {
|
|
76
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index');
|
|
77
|
+
return handleError(err, callback);
|
|
47
78
|
}
|
|
48
79
|
|
|
49
|
-
let { method, body, index, type, ...querystring } = params
|
|
50
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
80
|
+
let { method, body, index, type, ...querystring } = params;
|
|
81
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
51
82
|
|
|
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'
|
|
83
|
+
let path = '';
|
|
84
|
+
if (index != null && type != null) {
|
|
85
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
86
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count';
|
|
87
|
+
} else if (index != null) {
|
|
88
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
89
|
+
path = '/' + encodeURIComponent(index) + '/' + '_count';
|
|
59
90
|
} else {
|
|
60
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
61
|
-
path = '/' + '_count'
|
|
91
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
92
|
+
path = '/' + '_count';
|
|
62
93
|
}
|
|
63
94
|
|
|
64
95
|
// build request object
|
|
@@ -66,10 +97,10 @@ function countApi (params, options, callback) {
|
|
|
66
97
|
method,
|
|
67
98
|
path,
|
|
68
99
|
body: body || '',
|
|
69
|
-
querystring
|
|
70
|
-
}
|
|
100
|
+
querystring,
|
|
101
|
+
};
|
|
71
102
|
|
|
72
|
-
return this.transport.request(request, options, callback)
|
|
103
|
+
return this.transport.request(request, options, callback);
|
|
73
104
|
}
|
|
74
105
|
|
|
75
|
-
module.exports = countApi
|
|
106
|
+
module.exports = countApi;
|
package/api/api/create.js
CHANGED
|
@@ -28,42 +28,68 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = [
|
|
38
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'wait_for_active_shards',
|
|
39
|
+
'refresh',
|
|
40
|
+
'routing',
|
|
41
|
+
'timeout',
|
|
42
|
+
'version',
|
|
43
|
+
'version_type',
|
|
44
|
+
'pipeline',
|
|
45
|
+
'pretty',
|
|
46
|
+
'human',
|
|
47
|
+
'error_trace',
|
|
48
|
+
'source',
|
|
49
|
+
'filter_path',
|
|
50
|
+
];
|
|
51
|
+
const snakeCase = {
|
|
52
|
+
waitForActiveShards: 'wait_for_active_shards',
|
|
53
|
+
versionType: 'version_type',
|
|
54
|
+
errorTrace: 'error_trace',
|
|
55
|
+
filterPath: 'filter_path',
|
|
56
|
+
};
|
|
39
57
|
|
|
40
|
-
function createApi
|
|
41
|
-
|
|
58
|
+
function createApi(params, options, callback) {
|
|
59
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
60
|
|
|
43
61
|
// check required parameters
|
|
44
62
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
63
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
64
|
+
return handleError(err, callback);
|
|
47
65
|
}
|
|
48
66
|
if (params.index == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
50
|
-
return handleError(err, callback)
|
|
67
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
68
|
+
return handleError(err, callback);
|
|
51
69
|
}
|
|
52
70
|
if (params.body == null) {
|
|
53
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
54
|
-
return handleError(err, callback)
|
|
71
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
72
|
+
return handleError(err, callback);
|
|
55
73
|
}
|
|
56
74
|
|
|
57
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
58
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
75
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
76
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
59
77
|
|
|
60
|
-
let path = ''
|
|
61
|
-
if (
|
|
62
|
-
if (method == null) method = 'PUT'
|
|
63
|
-
path =
|
|
78
|
+
let path = '';
|
|
79
|
+
if (index != null && type != null && id != null) {
|
|
80
|
+
if (method == null) method = 'PUT';
|
|
81
|
+
path =
|
|
82
|
+
'/' +
|
|
83
|
+
encodeURIComponent(index) +
|
|
84
|
+
'/' +
|
|
85
|
+
encodeURIComponent(type) +
|
|
86
|
+
'/' +
|
|
87
|
+
encodeURIComponent(id) +
|
|
88
|
+
'/' +
|
|
89
|
+
'_create';
|
|
64
90
|
} else {
|
|
65
|
-
if (method == null) method = 'PUT'
|
|
66
|
-
path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id)
|
|
91
|
+
if (method == null) method = 'PUT';
|
|
92
|
+
path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id);
|
|
67
93
|
}
|
|
68
94
|
|
|
69
95
|
// build request object
|
|
@@ -71,10 +97,10 @@ function createApi (params, options, callback) {
|
|
|
71
97
|
method,
|
|
72
98
|
path,
|
|
73
99
|
body: body || '',
|
|
74
|
-
querystring
|
|
75
|
-
}
|
|
100
|
+
querystring,
|
|
101
|
+
};
|
|
76
102
|
|
|
77
|
-
return this.transport.request(request, options, callback)
|
|
103
|
+
return this.transport.request(request, options, callback);
|
|
78
104
|
}
|
|
79
105
|
|
|
80
|
-
module.exports = createApi
|
|
106
|
+
module.exports = createApi;
|
|
@@ -28,99 +28,143 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'accept_data_loss',
|
|
39
|
+
'timeout',
|
|
40
|
+
'cluster_manager_timeout',
|
|
41
|
+
'master_timeout',
|
|
42
|
+
'pretty',
|
|
43
|
+
'human',
|
|
44
|
+
'error_trace',
|
|
45
|
+
'source',
|
|
46
|
+
'filter_path',
|
|
47
|
+
];
|
|
48
|
+
const snakeCase = {
|
|
49
|
+
acceptDataLoss: 'accept_data_loss',
|
|
50
|
+
clusterManagerTimeout: 'cluster_manager_timeout',
|
|
51
|
+
masterTimeout: 'master_timeout',
|
|
52
|
+
errorTrace: 'error_trace',
|
|
53
|
+
filterPath: 'filter_path',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
function DanglingIndicesApi(transport, ConfigurationError) {
|
|
57
|
+
this.transport = transport;
|
|
58
|
+
this[kConfigurationError] = ConfigurationError;
|
|
43
59
|
}
|
|
44
60
|
|
|
45
|
-
DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDeleteDanglingIndexApi
|
|
46
|
-
|
|
61
|
+
DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDeleteDanglingIndexApi(
|
|
62
|
+
params,
|
|
63
|
+
options,
|
|
64
|
+
callback
|
|
65
|
+
) {
|
|
66
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
47
67
|
|
|
48
68
|
// check required parameters
|
|
49
69
|
if (params.index_uuid == null && params.indexUuid == null) {
|
|
50
|
-
const err = new this[kConfigurationError](
|
|
51
|
-
|
|
70
|
+
const err = new this[kConfigurationError](
|
|
71
|
+
'Missing required parameter: index_uuid or indexUuid'
|
|
72
|
+
);
|
|
73
|
+
return handleError(err, callback);
|
|
52
74
|
}
|
|
53
75
|
|
|
54
|
-
let { method, body, indexUuid, index_uuid, ...querystring } = params
|
|
55
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
76
|
+
let { method, body, indexUuid, index_uuid, ...querystring } = params;
|
|
77
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
56
78
|
|
|
57
|
-
let path = ''
|
|
58
|
-
if (method == null) method = 'DELETE'
|
|
59
|
-
path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid)
|
|
79
|
+
let path = '';
|
|
80
|
+
if (method == null) method = 'DELETE';
|
|
81
|
+
path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid);
|
|
60
82
|
|
|
61
83
|
// build request object
|
|
62
84
|
const request = {
|
|
63
85
|
method,
|
|
64
86
|
path,
|
|
65
87
|
body: body || '',
|
|
66
|
-
querystring
|
|
67
|
-
}
|
|
88
|
+
querystring,
|
|
89
|
+
};
|
|
68
90
|
|
|
69
|
-
return this.transport.request(request, options, callback)
|
|
70
|
-
}
|
|
91
|
+
return this.transport.request(request, options, callback);
|
|
92
|
+
};
|
|
71
93
|
|
|
72
|
-
DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImportDanglingIndexApi
|
|
73
|
-
|
|
94
|
+
DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImportDanglingIndexApi(
|
|
95
|
+
params,
|
|
96
|
+
options,
|
|
97
|
+
callback
|
|
98
|
+
) {
|
|
99
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
74
100
|
|
|
75
101
|
// check required parameters
|
|
76
102
|
if (params.index_uuid == null && params.indexUuid == null) {
|
|
77
|
-
const err = new this[kConfigurationError](
|
|
78
|
-
|
|
103
|
+
const err = new this[kConfigurationError](
|
|
104
|
+
'Missing required parameter: index_uuid or indexUuid'
|
|
105
|
+
);
|
|
106
|
+
return handleError(err, callback);
|
|
79
107
|
}
|
|
80
108
|
|
|
81
|
-
let { method, body, indexUuid, index_uuid, ...querystring } = params
|
|
82
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
109
|
+
let { method, body, indexUuid, index_uuid, ...querystring } = params;
|
|
110
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
83
111
|
|
|
84
|
-
let path = ''
|
|
85
|
-
if (method == null) method = 'POST'
|
|
86
|
-
path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid)
|
|
112
|
+
let path = '';
|
|
113
|
+
if (method == null) method = 'POST';
|
|
114
|
+
path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid);
|
|
87
115
|
|
|
88
116
|
// build request object
|
|
89
117
|
const request = {
|
|
90
118
|
method,
|
|
91
119
|
path,
|
|
92
120
|
body: body || '',
|
|
93
|
-
querystring
|
|
94
|
-
}
|
|
121
|
+
querystring,
|
|
122
|
+
};
|
|
95
123
|
|
|
96
|
-
return this.transport.request(request, options, callback)
|
|
97
|
-
}
|
|
124
|
+
return this.transport.request(request, options, callback);
|
|
125
|
+
};
|
|
98
126
|
|
|
99
|
-
DanglingIndicesApi.prototype.listDanglingIndices = function danglingIndicesListDanglingIndicesApi
|
|
100
|
-
|
|
127
|
+
DanglingIndicesApi.prototype.listDanglingIndices = function danglingIndicesListDanglingIndicesApi(
|
|
128
|
+
params,
|
|
129
|
+
options,
|
|
130
|
+
callback
|
|
131
|
+
) {
|
|
132
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
101
133
|
|
|
102
|
-
let { method, body, ...querystring } = params
|
|
103
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
134
|
+
let { method, body, ...querystring } = params;
|
|
135
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
104
136
|
|
|
105
|
-
let path = ''
|
|
106
|
-
if (method == null) method = 'GET'
|
|
107
|
-
path = '/' + '_dangling'
|
|
137
|
+
let path = '';
|
|
138
|
+
if (method == null) method = 'GET';
|
|
139
|
+
path = '/' + '_dangling';
|
|
108
140
|
|
|
109
141
|
// build request object
|
|
110
142
|
const request = {
|
|
111
143
|
method,
|
|
112
144
|
path,
|
|
113
145
|
body: null,
|
|
114
|
-
querystring
|
|
115
|
-
}
|
|
146
|
+
querystring,
|
|
147
|
+
};
|
|
116
148
|
|
|
117
|
-
return this.transport.request(request, options, callback)
|
|
118
|
-
}
|
|
149
|
+
return this.transport.request(request, options, callback);
|
|
150
|
+
};
|
|
119
151
|
|
|
120
152
|
Object.defineProperties(DanglingIndicesApi.prototype, {
|
|
121
|
-
delete_dangling_index: {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
153
|
+
delete_dangling_index: {
|
|
154
|
+
get() {
|
|
155
|
+
return this.deleteDanglingIndex;
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
import_dangling_index: {
|
|
159
|
+
get() {
|
|
160
|
+
return this.importDanglingIndex;
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
list_dangling_indices: {
|
|
164
|
+
get() {
|
|
165
|
+
return this.listDanglingIndices;
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
module.exports = DanglingIndicesApi;
|
package/api/api/delete.js
CHANGED
|
@@ -28,38 +28,65 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = [
|
|
38
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'wait_for_active_shards',
|
|
39
|
+
'refresh',
|
|
40
|
+
'routing',
|
|
41
|
+
'timeout',
|
|
42
|
+
'if_seq_no',
|
|
43
|
+
'if_primary_term',
|
|
44
|
+
'version',
|
|
45
|
+
'version_type',
|
|
46
|
+
'pretty',
|
|
47
|
+
'human',
|
|
48
|
+
'error_trace',
|
|
49
|
+
'source',
|
|
50
|
+
'filter_path',
|
|
51
|
+
];
|
|
52
|
+
const snakeCase = {
|
|
53
|
+
waitForActiveShards: 'wait_for_active_shards',
|
|
54
|
+
ifSeqNo: 'if_seq_no',
|
|
55
|
+
ifPrimaryTerm: 'if_primary_term',
|
|
56
|
+
versionType: 'version_type',
|
|
57
|
+
errorTrace: 'error_trace',
|
|
58
|
+
filterPath: 'filter_path',
|
|
59
|
+
};
|
|
39
60
|
|
|
40
|
-
function deleteApi
|
|
41
|
-
|
|
61
|
+
function deleteApi(params, options, callback) {
|
|
62
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
63
|
|
|
43
64
|
// check required parameters
|
|
44
65
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
66
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
67
|
+
return handleError(err, callback);
|
|
47
68
|
}
|
|
48
69
|
if (params.index == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
50
|
-
return handleError(err, callback)
|
|
70
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
71
|
+
return handleError(err, callback);
|
|
51
72
|
}
|
|
52
73
|
|
|
53
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
74
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
75
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
76
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (
|
|
58
|
-
if (method == null) method = 'DELETE'
|
|
59
|
-
path =
|
|
77
|
+
let path = '';
|
|
78
|
+
if (index != null && type != null && id != null) {
|
|
79
|
+
if (method == null) method = 'DELETE';
|
|
80
|
+
path =
|
|
81
|
+
'/' +
|
|
82
|
+
encodeURIComponent(index) +
|
|
83
|
+
'/' +
|
|
84
|
+
encodeURIComponent(type) +
|
|
85
|
+
'/' +
|
|
86
|
+
encodeURIComponent(id);
|
|
60
87
|
} else {
|
|
61
|
-
if (method == null) method = 'DELETE'
|
|
62
|
-
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
|
|
88
|
+
if (method == null) method = 'DELETE';
|
|
89
|
+
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id);
|
|
63
90
|
}
|
|
64
91
|
|
|
65
92
|
// build request object
|
|
@@ -67,10 +94,10 @@ function deleteApi (params, options, callback) {
|
|
|
67
94
|
method,
|
|
68
95
|
path,
|
|
69
96
|
body: body || '',
|
|
70
|
-
querystring
|
|
71
|
-
}
|
|
97
|
+
querystring,
|
|
98
|
+
};
|
|
72
99
|
|
|
73
|
-
return this.transport.request(request, options, callback)
|
|
100
|
+
return this.transport.request(request, options, callback);
|
|
74
101
|
}
|
|
75
102
|
|
|
76
|
-
module.exports = deleteApi
|
|
103
|
+
module.exports = deleteApi;
|
|
@@ -28,44 +28,107 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = [
|
|
38
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'analyzer',
|
|
39
|
+
'analyze_wildcard',
|
|
40
|
+
'default_operator',
|
|
41
|
+
'df',
|
|
42
|
+
'from',
|
|
43
|
+
'ignore_unavailable',
|
|
44
|
+
'allow_no_indices',
|
|
45
|
+
'conflicts',
|
|
46
|
+
'expand_wildcards',
|
|
47
|
+
'lenient',
|
|
48
|
+
'preference',
|
|
49
|
+
'q',
|
|
50
|
+
'routing',
|
|
51
|
+
'scroll',
|
|
52
|
+
'search_type',
|
|
53
|
+
'search_timeout',
|
|
54
|
+
'size',
|
|
55
|
+
'max_docs',
|
|
56
|
+
'sort',
|
|
57
|
+
'_source',
|
|
58
|
+
'_source_excludes',
|
|
59
|
+
'_source_exclude',
|
|
60
|
+
'_source_includes',
|
|
61
|
+
'_source_include',
|
|
62
|
+
'terminate_after',
|
|
63
|
+
'stats',
|
|
64
|
+
'version',
|
|
65
|
+
'request_cache',
|
|
66
|
+
'refresh',
|
|
67
|
+
'timeout',
|
|
68
|
+
'wait_for_active_shards',
|
|
69
|
+
'scroll_size',
|
|
70
|
+
'wait_for_completion',
|
|
71
|
+
'requests_per_second',
|
|
72
|
+
'slices',
|
|
73
|
+
'pretty',
|
|
74
|
+
'human',
|
|
75
|
+
'error_trace',
|
|
76
|
+
'source',
|
|
77
|
+
'filter_path',
|
|
78
|
+
];
|
|
79
|
+
const snakeCase = {
|
|
80
|
+
analyzeWildcard: 'analyze_wildcard',
|
|
81
|
+
defaultOperator: 'default_operator',
|
|
82
|
+
ignoreUnavailable: 'ignore_unavailable',
|
|
83
|
+
allowNoIndices: 'allow_no_indices',
|
|
84
|
+
expandWildcards: 'expand_wildcards',
|
|
85
|
+
searchType: 'search_type',
|
|
86
|
+
searchTimeout: 'search_timeout',
|
|
87
|
+
maxDocs: 'max_docs',
|
|
88
|
+
_sourceExcludes: '_source_excludes',
|
|
89
|
+
_sourceExclude: '_source_exclude',
|
|
90
|
+
_sourceIncludes: '_source_includes',
|
|
91
|
+
_sourceInclude: '_source_include',
|
|
92
|
+
terminateAfter: 'terminate_after',
|
|
93
|
+
requestCache: 'request_cache',
|
|
94
|
+
waitForActiveShards: 'wait_for_active_shards',
|
|
95
|
+
scrollSize: 'scroll_size',
|
|
96
|
+
waitForCompletion: 'wait_for_completion',
|
|
97
|
+
requestsPerSecond: 'requests_per_second',
|
|
98
|
+
errorTrace: 'error_trace',
|
|
99
|
+
filterPath: 'filter_path',
|
|
100
|
+
};
|
|
39
101
|
|
|
40
|
-
function deleteByQueryApi
|
|
41
|
-
|
|
102
|
+
function deleteByQueryApi(params, options, callback) {
|
|
103
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
104
|
|
|
43
105
|
// check required parameters
|
|
44
106
|
if (params.index == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
46
|
-
return handleError(err, callback)
|
|
107
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
108
|
+
return handleError(err, callback);
|
|
47
109
|
}
|
|
48
110
|
if (params.body == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
50
|
-
return handleError(err, callback)
|
|
111
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
112
|
+
return handleError(err, callback);
|
|
51
113
|
}
|
|
52
114
|
|
|
53
115
|
// 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)
|
|
116
|
+
if (params.type != null && params.index == null) {
|
|
117
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index');
|
|
118
|
+
return handleError(err, callback);
|
|
57
119
|
}
|
|
58
120
|
|
|
59
|
-
let { method, body, index, type, ...querystring } = params
|
|
60
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
121
|
+
let { method, body, index, type, ...querystring } = params;
|
|
122
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
61
123
|
|
|
62
|
-
let path = ''
|
|
63
|
-
if (
|
|
64
|
-
if (method == null) method = 'POST'
|
|
65
|
-
path =
|
|
124
|
+
let path = '';
|
|
125
|
+
if (index != null && type != null) {
|
|
126
|
+
if (method == null) method = 'POST';
|
|
127
|
+
path =
|
|
128
|
+
'/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query';
|
|
66
129
|
} else {
|
|
67
|
-
if (method == null) method = 'POST'
|
|
68
|
-
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
|
|
130
|
+
if (method == null) method = 'POST';
|
|
131
|
+
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query';
|
|
69
132
|
}
|
|
70
133
|
|
|
71
134
|
// build request object
|
|
@@ -73,10 +136,10 @@ function deleteByQueryApi (params, options, callback) {
|
|
|
73
136
|
method,
|
|
74
137
|
path,
|
|
75
138
|
body: body || '',
|
|
76
|
-
querystring
|
|
77
|
-
}
|
|
139
|
+
querystring,
|
|
140
|
+
};
|
|
78
141
|
|
|
79
|
-
return this.transport.request(request, options, callback)
|
|
142
|
+
return this.transport.request(request, options, callback);
|
|
80
143
|
}
|
|
81
144
|
|
|
82
|
-
module.exports = deleteByQueryApi
|
|
145
|
+
module.exports = deleteByQueryApi;
|