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