@opensearch-project/opensearch 1.0.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 +102 -106
- 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 +275 -0
- 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 +4779 -934
- package/index.js +153 -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 -63
- 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 +383 -324
- 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
|
@@ -28,44 +28,58 @@
|
|
|
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
|
+
'requests_per_second',
|
|
39
|
+
'pretty',
|
|
40
|
+
'human',
|
|
41
|
+
'error_trace',
|
|
42
|
+
'source',
|
|
43
|
+
'filter_path',
|
|
44
|
+
];
|
|
45
|
+
const snakeCase = {
|
|
46
|
+
requestsPerSecond: 'requests_per_second',
|
|
47
|
+
errorTrace: 'error_trace',
|
|
48
|
+
filterPath: 'filter_path',
|
|
49
|
+
};
|
|
39
50
|
|
|
40
|
-
function deleteByQueryRethrottleApi
|
|
41
|
-
|
|
51
|
+
function deleteByQueryRethrottleApi(params, options, callback) {
|
|
52
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
53
|
|
|
43
54
|
// check required parameters
|
|
44
55
|
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)
|
|
56
|
+
const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId');
|
|
57
|
+
return handleError(err, callback);
|
|
47
58
|
}
|
|
48
59
|
if (params.requests_per_second == null && params.requestsPerSecond == null) {
|
|
49
|
-
const err = new this[kConfigurationError](
|
|
50
|
-
|
|
60
|
+
const err = new this[kConfigurationError](
|
|
61
|
+
'Missing required parameter: requests_per_second or requestsPerSecond'
|
|
62
|
+
);
|
|
63
|
+
return handleError(err, callback);
|
|
51
64
|
}
|
|
52
65
|
|
|
53
|
-
let { method, body, taskId, task_id, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
66
|
+
let { method, body, taskId, task_id, ...querystring } = params;
|
|
67
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
68
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (method == null) method = 'POST'
|
|
58
|
-
path =
|
|
69
|
+
let path = '';
|
|
70
|
+
if (method == null) method = 'POST';
|
|
71
|
+
path =
|
|
72
|
+
'/' + '_delete_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle';
|
|
59
73
|
|
|
60
74
|
// build request object
|
|
61
75
|
const request = {
|
|
62
76
|
method,
|
|
63
77
|
path,
|
|
64
78
|
body: body || '',
|
|
65
|
-
querystring
|
|
66
|
-
}
|
|
79
|
+
querystring,
|
|
80
|
+
};
|
|
67
81
|
|
|
68
|
-
return this.transport.request(request, options, callback)
|
|
82
|
+
return this.transport.request(request, options, callback);
|
|
69
83
|
}
|
|
70
84
|
|
|
71
|
-
module.exports = deleteByQueryRethrottleApi
|
|
85
|
+
module.exports = deleteByQueryRethrottleApi;
|
package/api/api/delete_script.js
CHANGED
|
@@ -28,40 +28,54 @@
|
|
|
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
|
+
'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
|
+
clusterManagerTimeout: 'cluster_manager_timeout',
|
|
49
|
+
masterTimeout: 'master_timeout',
|
|
50
|
+
errorTrace: 'error_trace',
|
|
51
|
+
filterPath: 'filter_path',
|
|
52
|
+
};
|
|
39
53
|
|
|
40
|
-
function deleteScriptApi
|
|
41
|
-
|
|
54
|
+
function deleteScriptApi(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
|
|
|
49
|
-
let { method, body, id, ...querystring } = params
|
|
50
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
63
|
+
let { method, body, id, ...querystring } = params;
|
|
64
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
51
65
|
|
|
52
|
-
let path = ''
|
|
53
|
-
if (method == null) method = 'DELETE'
|
|
54
|
-
path = '/' + '_scripts' + '/' + encodeURIComponent(id)
|
|
66
|
+
let path = '';
|
|
67
|
+
if (method == null) method = 'DELETE';
|
|
68
|
+
path = '/' + '_scripts' + '/' + encodeURIComponent(id);
|
|
55
69
|
|
|
56
70
|
// build request object
|
|
57
71
|
const request = {
|
|
58
72
|
method,
|
|
59
73
|
path,
|
|
60
74
|
body: body || '',
|
|
61
|
-
querystring
|
|
62
|
-
}
|
|
75
|
+
querystring,
|
|
76
|
+
};
|
|
63
77
|
|
|
64
|
-
return this.transport.request(request, options, callback)
|
|
78
|
+
return this.transport.request(request, options, callback);
|
|
65
79
|
}
|
|
66
80
|
|
|
67
|
-
module.exports = deleteScriptApi
|
|
81
|
+
module.exports = deleteScriptApi;
|
package/api/api/exists.js
CHANGED
|
@@ -28,38 +28,71 @@
|
|
|
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
|
+
'stored_fields',
|
|
39
|
+
'preference',
|
|
40
|
+
'realtime',
|
|
41
|
+
'refresh',
|
|
42
|
+
'routing',
|
|
43
|
+
'_source',
|
|
44
|
+
'_source_excludes',
|
|
45
|
+
'_source_exclude',
|
|
46
|
+
'_source_includes',
|
|
47
|
+
'_source_include',
|
|
48
|
+
'version',
|
|
49
|
+
'version_type',
|
|
50
|
+
'pretty',
|
|
51
|
+
'human',
|
|
52
|
+
'error_trace',
|
|
53
|
+
'source',
|
|
54
|
+
'filter_path',
|
|
55
|
+
];
|
|
56
|
+
const snakeCase = {
|
|
57
|
+
storedFields: 'stored_fields',
|
|
58
|
+
_sourceExcludes: '_source_excludes',
|
|
59
|
+
_sourceExclude: '_source_exclude',
|
|
60
|
+
_sourceIncludes: '_source_includes',
|
|
61
|
+
_sourceInclude: '_source_include',
|
|
62
|
+
versionType: 'version_type',
|
|
63
|
+
errorTrace: 'error_trace',
|
|
64
|
+
filterPath: 'filter_path',
|
|
65
|
+
};
|
|
39
66
|
|
|
40
|
-
function existsApi
|
|
41
|
-
|
|
67
|
+
function existsApi(params, options, callback) {
|
|
68
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
69
|
|
|
43
70
|
// check required parameters
|
|
44
71
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
72
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
73
|
+
return handleError(err, callback);
|
|
47
74
|
}
|
|
48
75
|
if (params.index == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
50
|
-
return handleError(err, callback)
|
|
76
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
77
|
+
return handleError(err, callback);
|
|
51
78
|
}
|
|
52
79
|
|
|
53
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
80
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
81
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
82
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (
|
|
58
|
-
if (method == null) method = 'HEAD'
|
|
59
|
-
path =
|
|
83
|
+
let path = '';
|
|
84
|
+
if (index != null && type != null && id != null) {
|
|
85
|
+
if (method == null) method = 'HEAD';
|
|
86
|
+
path =
|
|
87
|
+
'/' +
|
|
88
|
+
encodeURIComponent(index) +
|
|
89
|
+
'/' +
|
|
90
|
+
encodeURIComponent(type) +
|
|
91
|
+
'/' +
|
|
92
|
+
encodeURIComponent(id);
|
|
60
93
|
} else {
|
|
61
|
-
if (method == null) method = 'HEAD'
|
|
62
|
-
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
|
|
94
|
+
if (method == null) method = 'HEAD';
|
|
95
|
+
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id);
|
|
63
96
|
}
|
|
64
97
|
|
|
65
98
|
// build request object
|
|
@@ -67,10 +100,10 @@ function existsApi (params, options, callback) {
|
|
|
67
100
|
method,
|
|
68
101
|
path,
|
|
69
102
|
body: null,
|
|
70
|
-
querystring
|
|
71
|
-
}
|
|
103
|
+
querystring,
|
|
104
|
+
};
|
|
72
105
|
|
|
73
|
-
return this.transport.request(request, options, callback)
|
|
106
|
+
return this.transport.request(request, options, callback);
|
|
74
107
|
}
|
|
75
108
|
|
|
76
|
-
module.exports = existsApi
|
|
109
|
+
module.exports = existsApi;
|
package/api/api/exists_source.js
CHANGED
|
@@ -28,47 +28,80 @@
|
|
|
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
|
+
'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
|
+
_sourceExcludes: '_source_excludes',
|
|
57
|
+
_sourceExclude: '_source_exclude',
|
|
58
|
+
_sourceIncludes: '_source_includes',
|
|
59
|
+
_sourceInclude: '_source_include',
|
|
60
|
+
versionType: 'version_type',
|
|
61
|
+
errorTrace: 'error_trace',
|
|
62
|
+
filterPath: 'filter_path',
|
|
63
|
+
};
|
|
39
64
|
|
|
40
|
-
function existsSourceApi
|
|
41
|
-
|
|
65
|
+
function existsSourceApi(params, options, callback) {
|
|
66
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
67
|
|
|
43
68
|
// check required parameters
|
|
44
69
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
70
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
71
|
+
return handleError(err, callback);
|
|
47
72
|
}
|
|
48
73
|
if (params.index == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
50
|
-
return handleError(err, callback)
|
|
74
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
75
|
+
return handleError(err, callback);
|
|
51
76
|
}
|
|
52
77
|
|
|
53
78
|
// check required url components
|
|
54
79
|
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)
|
|
80
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: type, index');
|
|
81
|
+
return handleError(err, callback);
|
|
82
|
+
} else if (params.type != null && params.index == null) {
|
|
83
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index');
|
|
84
|
+
return handleError(err, callback);
|
|
60
85
|
}
|
|
61
86
|
|
|
62
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
63
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
87
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
88
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
64
89
|
|
|
65
|
-
let path = ''
|
|
66
|
-
if (
|
|
67
|
-
if (method == null) method = 'HEAD'
|
|
68
|
-
path =
|
|
90
|
+
let path = '';
|
|
91
|
+
if (index != null && type != null && id != null) {
|
|
92
|
+
if (method == null) method = 'HEAD';
|
|
93
|
+
path =
|
|
94
|
+
'/' +
|
|
95
|
+
encodeURIComponent(index) +
|
|
96
|
+
'/' +
|
|
97
|
+
encodeURIComponent(type) +
|
|
98
|
+
'/' +
|
|
99
|
+
encodeURIComponent(id) +
|
|
100
|
+
'/' +
|
|
101
|
+
'_source';
|
|
69
102
|
} else {
|
|
70
|
-
if (method == null) method = 'HEAD'
|
|
71
|
-
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
|
|
103
|
+
if (method == null) method = 'HEAD';
|
|
104
|
+
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id);
|
|
72
105
|
}
|
|
73
106
|
|
|
74
107
|
// build request object
|
|
@@ -76,10 +109,10 @@ function existsSourceApi (params, options, callback) {
|
|
|
76
109
|
method,
|
|
77
110
|
path,
|
|
78
111
|
body: null,
|
|
79
|
-
querystring
|
|
80
|
-
}
|
|
112
|
+
querystring,
|
|
113
|
+
};
|
|
81
114
|
|
|
82
|
-
return this.transport.request(request, options, callback)
|
|
115
|
+
return this.transport.request(request, options, callback);
|
|
83
116
|
}
|
|
84
117
|
|
|
85
|
-
module.exports = existsSourceApi
|
|
118
|
+
module.exports = existsSourceApi;
|
package/api/api/explain.js
CHANGED
|
@@ -28,38 +28,76 @@
|
|
|
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
|
+
'analyze_wildcard',
|
|
39
|
+
'analyzer',
|
|
40
|
+
'default_operator',
|
|
41
|
+
'df',
|
|
42
|
+
'stored_fields',
|
|
43
|
+
'lenient',
|
|
44
|
+
'preference',
|
|
45
|
+
'q',
|
|
46
|
+
'routing',
|
|
47
|
+
'_source',
|
|
48
|
+
'_source_excludes',
|
|
49
|
+
'_source_exclude',
|
|
50
|
+
'_source_includes',
|
|
51
|
+
'_source_include',
|
|
52
|
+
'pretty',
|
|
53
|
+
'human',
|
|
54
|
+
'error_trace',
|
|
55
|
+
'source',
|
|
56
|
+
'filter_path',
|
|
57
|
+
];
|
|
58
|
+
const snakeCase = {
|
|
59
|
+
analyzeWildcard: 'analyze_wildcard',
|
|
60
|
+
defaultOperator: 'default_operator',
|
|
61
|
+
storedFields: 'stored_fields',
|
|
62
|
+
_sourceExcludes: '_source_excludes',
|
|
63
|
+
_sourceExclude: '_source_exclude',
|
|
64
|
+
_sourceIncludes: '_source_includes',
|
|
65
|
+
_sourceInclude: '_source_include',
|
|
66
|
+
errorTrace: 'error_trace',
|
|
67
|
+
filterPath: 'filter_path',
|
|
68
|
+
};
|
|
39
69
|
|
|
40
|
-
function explainApi
|
|
41
|
-
|
|
70
|
+
function explainApi(params, options, callback) {
|
|
71
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
72
|
|
|
43
73
|
// check required parameters
|
|
44
74
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
75
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
76
|
+
return handleError(err, callback);
|
|
47
77
|
}
|
|
48
78
|
if (params.index == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
50
|
-
return handleError(err, callback)
|
|
79
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
80
|
+
return handleError(err, callback);
|
|
51
81
|
}
|
|
52
82
|
|
|
53
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
83
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
84
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
85
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (
|
|
58
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
59
|
-
path =
|
|
86
|
+
let path = '';
|
|
87
|
+
if (index != null && type != null && id != null) {
|
|
88
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
89
|
+
path =
|
|
90
|
+
'/' +
|
|
91
|
+
encodeURIComponent(index) +
|
|
92
|
+
'/' +
|
|
93
|
+
encodeURIComponent(type) +
|
|
94
|
+
'/' +
|
|
95
|
+
encodeURIComponent(id) +
|
|
96
|
+
'/' +
|
|
97
|
+
'_explain';
|
|
60
98
|
} else {
|
|
61
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
62
|
-
path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id)
|
|
99
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
100
|
+
path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id);
|
|
63
101
|
}
|
|
64
102
|
|
|
65
103
|
// build request object
|
|
@@ -67,10 +105,10 @@ function explainApi (params, options, callback) {
|
|
|
67
105
|
method,
|
|
68
106
|
path,
|
|
69
107
|
body: body || '',
|
|
70
|
-
querystring
|
|
71
|
-
}
|
|
108
|
+
querystring,
|
|
109
|
+
};
|
|
72
110
|
|
|
73
|
-
return this.transport.request(request, options, callback)
|
|
111
|
+
return this.transport.request(request, options, callback);
|
|
74
112
|
}
|
|
75
113
|
|
|
76
|
-
module.exports = explainApi
|
|
114
|
+
module.exports = explainApi;
|
package/api/api/features.js
CHANGED
|
@@ -28,65 +28,86 @@
|
|
|
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
|
+
'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
|
+
};
|
|
52
|
+
|
|
53
|
+
function FeaturesApi(transport, ConfigurationError) {
|
|
54
|
+
this.transport = transport;
|
|
55
|
+
this[kConfigurationError] = ConfigurationError;
|
|
43
56
|
}
|
|
44
57
|
|
|
45
|
-
FeaturesApi.prototype.getFeatures = function featuresGetFeaturesApi
|
|
46
|
-
|
|
58
|
+
FeaturesApi.prototype.getFeatures = function featuresGetFeaturesApi(params, options, callback) {
|
|
59
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
47
60
|
|
|
48
|
-
let { method, body, ...querystring } = params
|
|
49
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
61
|
+
let { method, body, ...querystring } = params;
|
|
62
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
50
63
|
|
|
51
|
-
let path = ''
|
|
52
|
-
if (method == null) method = 'GET'
|
|
53
|
-
path = '/' + '_features'
|
|
64
|
+
let path = '';
|
|
65
|
+
if (method == null) method = 'GET';
|
|
66
|
+
path = '/' + '_features';
|
|
54
67
|
|
|
55
68
|
// build request object
|
|
56
69
|
const request = {
|
|
57
70
|
method,
|
|
58
71
|
path,
|
|
59
72
|
body: null,
|
|
60
|
-
querystring
|
|
61
|
-
}
|
|
73
|
+
querystring,
|
|
74
|
+
};
|
|
62
75
|
|
|
63
|
-
return this.transport.request(request, options, callback)
|
|
64
|
-
}
|
|
76
|
+
return this.transport.request(request, options, callback);
|
|
77
|
+
};
|
|
65
78
|
|
|
66
|
-
FeaturesApi.prototype.resetFeatures = function featuresResetFeaturesApi
|
|
67
|
-
|
|
79
|
+
FeaturesApi.prototype.resetFeatures = function featuresResetFeaturesApi(params, options, callback) {
|
|
80
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
68
81
|
|
|
69
|
-
let { method, body, ...querystring } = params
|
|
70
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
82
|
+
let { method, body, ...querystring } = params;
|
|
83
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
71
84
|
|
|
72
|
-
let path = ''
|
|
73
|
-
if (method == null) method = 'POST'
|
|
74
|
-
path = '/' + '_features' + '/' + '_reset'
|
|
85
|
+
let path = '';
|
|
86
|
+
if (method == null) method = 'POST';
|
|
87
|
+
path = '/' + '_features' + '/' + '_reset';
|
|
75
88
|
|
|
76
89
|
// build request object
|
|
77
90
|
const request = {
|
|
78
91
|
method,
|
|
79
92
|
path,
|
|
80
93
|
body: body || '',
|
|
81
|
-
querystring
|
|
82
|
-
}
|
|
94
|
+
querystring,
|
|
95
|
+
};
|
|
83
96
|
|
|
84
|
-
return this.transport.request(request, options, callback)
|
|
85
|
-
}
|
|
97
|
+
return this.transport.request(request, options, callback);
|
|
98
|
+
};
|
|
86
99
|
|
|
87
100
|
Object.defineProperties(FeaturesApi.prototype, {
|
|
88
|
-
get_features: {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
101
|
+
get_features: {
|
|
102
|
+
get() {
|
|
103
|
+
return this.getFeatures;
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
reset_features: {
|
|
107
|
+
get() {
|
|
108
|
+
return this.resetFeatures;
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
module.exports = FeaturesApi;
|