@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.
Files changed (94) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.json +31 -0
  3. package/.prettierrc.json +5 -0
  4. package/.whitesource +15 -0
  5. package/ADMINS.md +13 -31
  6. package/CHANGELOG.md +24 -0
  7. package/COMPATIBILITY.md +27 -0
  8. package/DEVELOPER_GUIDE.md +22 -5
  9. package/MAINTAINERS.md +15 -70
  10. package/Makefile +2 -12
  11. package/README.md +19 -123
  12. package/RELEASING.md +3 -3
  13. package/SECURITY.md +1 -1
  14. package/USER_GUIDE.md +197 -0
  15. package/api/api/bulk.js +54 -28
  16. package/api/api/cat.js +355 -266
  17. package/api/api/clear_scroll.js +18 -19
  18. package/api/api/cluster.js +367 -221
  19. package/api/api/count.js +56 -26
  20. package/api/api/create.js +51 -26
  21. package/api/api/dangling_indices.js +96 -53
  22. package/api/api/delete.js +50 -24
  23. package/api/api/delete_by_query.js +89 -27
  24. package/api/api/delete_by_query_rethrottle.js +34 -21
  25. package/api/api/delete_script.js +32 -19
  26. package/api/api/exists.js +56 -24
  27. package/api/api/exists_source.js +61 -29
  28. package/api/api/explain.js +61 -24
  29. package/api/api/features.js +57 -37
  30. package/api/api/field_caps.js +37 -20
  31. package/api/api/get.js +56 -24
  32. package/api/api/get_script.js +31 -19
  33. package/api/api/get_script_context.js +16 -17
  34. package/api/api/get_script_languages.js +16 -17
  35. package/api/api/get_source.js +56 -24
  36. package/api/api/index.js +61 -30
  37. package/api/api/indices.js +1069 -859
  38. package/api/api/info.js +16 -17
  39. package/api/api/ingest.js +133 -98
  40. package/api/api/mget.js +51 -28
  41. package/api/api/msearch.js +50 -28
  42. package/api/api/msearch_template.js +54 -28
  43. package/api/api/mtermvectors.js +49 -26
  44. package/api/api/nodes.js +282 -156
  45. package/api/api/ping.js +16 -17
  46. package/api/api/put_script.js +41 -27
  47. package/api/api/rank_eval.js +38 -22
  48. package/api/api/reindex.js +39 -19
  49. package/api/api/reindex_rethrottle.js +33 -21
  50. package/api/api/render_search_template.js +19 -20
  51. package/api/api/scripts_painless_execute.js +16 -17
  52. package/api/api/scroll.js +32 -19
  53. package/api/api/search.js +109 -26
  54. package/api/api/search_shards.js +37 -20
  55. package/api/api/search_template.js +65 -28
  56. package/api/api/shutdown.js +67 -56
  57. package/api/api/snapshot.js +348 -226
  58. package/api/api/tasks.js +66 -48
  59. package/api/api/terms_enum.js +18 -19
  60. package/api/api/termvectors.js +58 -28
  61. package/api/api/update.js +65 -26
  62. package/api/api/update_by_query.js +90 -25
  63. package/api/api/update_by_query_rethrottle.js +34 -21
  64. package/api/index.js +268 -181
  65. package/api/new.d.ts +2043 -531
  66. package/api/opensearch_dashboards.d.ts +240 -238
  67. package/api/requestParams.d.ts +302 -71
  68. package/api/types.d.ts +6205 -5721
  69. package/api/utils.js +23 -24
  70. package/codecov.yml +2 -2
  71. package/index.d.ts +5203 -1037
  72. package/index.js +154 -143
  73. package/index.mjs +10 -11
  74. package/jenkins/release.JenkinsFile +11 -0
  75. package/lib/Connection.d.ts +38 -28
  76. package/lib/Connection.js +166 -170
  77. package/lib/Helpers.d.ts +108 -68
  78. package/lib/Helpers.js +401 -378
  79. package/lib/Serializer.d.ts +3 -4
  80. package/lib/Serializer.js +40 -41
  81. package/lib/Transport.d.ts +39 -15
  82. package/lib/Transport.js +381 -337
  83. package/lib/aws/AwsSigv4Signer.js +167 -0
  84. package/lib/aws/errors.js +24 -0
  85. package/lib/aws/index.d.ts +39 -0
  86. package/lib/aws/index.js +19 -0
  87. package/lib/errors.d.ts +26 -9
  88. package/lib/errors.js +76 -73
  89. package/lib/pool/BaseConnectionPool.js +101 -99
  90. package/lib/pool/CloudConnectionPool.js +17 -18
  91. package/lib/pool/ConnectionPool.js +106 -107
  92. package/lib/pool/index.d.ts +9 -8
  93. package/lib/pool/index.js +7 -8
  94. package/package.json +37 -15
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -28,44 +27,59 @@
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 = ['timeout', 'master_timeout', 'context', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'cluster_manager_timeout',
38
+ 'timeout',
39
+ 'master_timeout',
40
+ 'context',
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 putScriptApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
54
+ function putScriptApi(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
  if (params.body == null) {
49
- const err = new this[kConfigurationError]('Missing required parameter: body')
50
- return handleError(err, callback)
63
+ const err = new this[kConfigurationError]('Missing required parameter: body');
64
+ return handleError(err, callback);
51
65
  }
52
66
 
53
67
  // check required url components
54
- if (params.context != null && (params.id == null)) {
55
- const err = new this[kConfigurationError]('Missing required parameter of the url: id')
56
- return handleError(err, callback)
68
+ if (params.context != null && params.id == null) {
69
+ const err = new this[kConfigurationError]('Missing required parameter of the url: id');
70
+ return handleError(err, callback);
57
71
  }
58
72
 
59
- let { method, body, id, context, ...querystring } = params
60
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
73
+ let { method, body, id, context, ...querystring } = params;
74
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
61
75
 
62
- let path = ''
63
- if ((id) != null && (context) != null) {
64
- if (method == null) method = 'PUT'
65
- path = '/' + '_scripts' + '/' + encodeURIComponent(id) + '/' + encodeURIComponent(context)
76
+ let path = '';
77
+ if (id != null && context != null) {
78
+ if (method == null) method = 'PUT';
79
+ path = '/' + '_scripts' + '/' + encodeURIComponent(id) + '/' + encodeURIComponent(context);
66
80
  } else {
67
- if (method == null) method = 'PUT'
68
- path = '/' + '_scripts' + '/' + encodeURIComponent(id)
81
+ if (method == null) method = 'PUT';
82
+ path = '/' + '_scripts' + '/' + encodeURIComponent(id);
69
83
  }
70
84
 
71
85
  // build request object
@@ -73,10 +87,10 @@ function putScriptApi (params, options, callback) {
73
87
  method,
74
88
  path,
75
89
  body: body || '',
76
- querystring
77
- }
90
+ querystring,
91
+ };
78
92
 
79
- return this.transport.request(request, options, callback)
93
+ return this.transport.request(request, options, callback);
80
94
  }
81
95
 
82
- module.exports = putScriptApi
96
+ module.exports = putScriptApi;
@@ -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,34 +27,51 @@
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 = ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'search_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'ignore_unavailable',
38
+ 'allow_no_indices',
39
+ 'expand_wildcards',
40
+ 'search_type',
41
+ 'pretty',
42
+ 'human',
43
+ 'error_trace',
44
+ 'source',
45
+ 'filter_path',
46
+ ];
47
+ const snakeCase = {
48
+ ignoreUnavailable: 'ignore_unavailable',
49
+ allowNoIndices: 'allow_no_indices',
50
+ expandWildcards: 'expand_wildcards',
51
+ searchType: 'search_type',
52
+ errorTrace: 'error_trace',
53
+ filterPath: 'filter_path',
54
+ };
39
55
 
40
- function rankEvalApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
56
+ function rankEvalApi(params, options, callback) {
57
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
58
 
43
59
  // check required parameters
44
60
  if (params.body == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: body')
46
- return handleError(err, callback)
61
+ const err = new this[kConfigurationError]('Missing required parameter: body');
62
+ return handleError(err, callback);
47
63
  }
48
64
 
49
- let { method, body, index, ...querystring } = params
50
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
65
+ let { method, body, index, ...querystring } = params;
66
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
51
67
 
52
- let path = ''
53
- if ((index) != null) {
54
- if (method == null) method = body == null ? 'GET' : 'POST'
55
- path = '/' + encodeURIComponent(index) + '/' + '_rank_eval'
68
+ let path = '';
69
+ if (index != null) {
70
+ if (method == null) method = body == null ? 'GET' : 'POST';
71
+ path = '/' + encodeURIComponent(index) + '/' + '_rank_eval';
56
72
  } else {
57
- if (method == null) method = body == null ? 'GET' : 'POST'
58
- path = '/' + '_rank_eval'
73
+ if (method == null) method = body == null ? 'GET' : 'POST';
74
+ path = '/' + '_rank_eval';
59
75
  }
60
76
 
61
77
  // build request object
@@ -63,10 +79,10 @@ function rankEvalApi (params, options, callback) {
63
79
  method,
64
80
  path,
65
81
  body: body || '',
66
- querystring
67
- }
82
+ querystring,
83
+ };
68
84
 
69
- return this.transport.request(request, options, callback)
85
+ return this.transport.request(request, options, callback);
70
86
  }
71
87
 
72
- module.exports = rankEvalApi
88
+ module.exports = rankEvalApi;
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -28,40 +27,61 @@
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 = ['refresh', 'timeout', 'wait_for_active_shards', 'wait_for_completion', 'requests_per_second', 'scroll', 'slices', 'max_docs', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { waitForActiveShards: 'wait_for_active_shards', waitForCompletion: 'wait_for_completion', requestsPerSecond: 'requests_per_second', maxDocs: 'max_docs', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'refresh',
38
+ 'timeout',
39
+ 'wait_for_active_shards',
40
+ 'wait_for_completion',
41
+ 'requests_per_second',
42
+ 'scroll',
43
+ 'slices',
44
+ 'max_docs',
45
+ 'pretty',
46
+ 'human',
47
+ 'error_trace',
48
+ 'source',
49
+ 'filter_path',
50
+ ];
51
+ const snakeCase = {
52
+ waitForActiveShards: 'wait_for_active_shards',
53
+ waitForCompletion: 'wait_for_completion',
54
+ requestsPerSecond: 'requests_per_second',
55
+ maxDocs: 'max_docs',
56
+ errorTrace: 'error_trace',
57
+ filterPath: 'filter_path',
58
+ };
39
59
 
40
- function reindexApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
60
+ function reindexApi(params, options, callback) {
61
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
62
 
43
63
  // check required parameters
44
64
  if (params.body == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: body')
46
- return handleError(err, callback)
65
+ const err = new this[kConfigurationError]('Missing required parameter: body');
66
+ return handleError(err, callback);
47
67
  }
48
68
 
49
- let { method, body, ...querystring } = params
50
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
69
+ let { method, body, ...querystring } = params;
70
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
51
71
 
52
- let path = ''
53
- if (method == null) method = 'POST'
54
- path = '/' + '_reindex'
72
+ let path = '';
73
+ if (method == null) method = 'POST';
74
+ path = '/' + '_reindex';
55
75
 
56
76
  // build request object
57
77
  const request = {
58
78
  method,
59
79
  path,
60
80
  body: body || '',
61
- querystring
62
- }
81
+ querystring,
82
+ };
63
83
 
64
- return this.transport.request(request, options, callback)
84
+ return this.transport.request(request, options, callback);
65
85
  }
66
86
 
67
- module.exports = reindexApi
87
+ module.exports = reindexApi;
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -28,44 +27,57 @@
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 = ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { requestsPerSecond: 'requests_per_second', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'requests_per_second',
38
+ 'pretty',
39
+ 'human',
40
+ 'error_trace',
41
+ 'source',
42
+ 'filter_path',
43
+ ];
44
+ const snakeCase = {
45
+ requestsPerSecond: 'requests_per_second',
46
+ errorTrace: 'error_trace',
47
+ filterPath: 'filter_path',
48
+ };
39
49
 
40
- function reindexRethrottleApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
50
+ function reindexRethrottleApi(params, options, callback) {
51
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
52
 
43
53
  // check required parameters
44
54
  if (params.task_id == null && params.taskId == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId')
46
- return handleError(err, callback)
55
+ const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId');
56
+ return handleError(err, callback);
47
57
  }
48
58
  if (params.requests_per_second == null && params.requestsPerSecond == null) {
49
- const err = new this[kConfigurationError]('Missing required parameter: requests_per_second or requestsPerSecond')
50
- return handleError(err, callback)
59
+ const err = new this[kConfigurationError](
60
+ 'Missing required parameter: requests_per_second or requestsPerSecond'
61
+ );
62
+ return handleError(err, callback);
51
63
  }
52
64
 
53
- let { method, body, taskId, task_id, ...querystring } = params
54
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
65
+ let { method, body, taskId, task_id, ...querystring } = params;
66
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
55
67
 
56
- let path = ''
57
- if (method == null) method = 'POST'
58
- path = '/' + '_reindex' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle'
68
+ let path = '';
69
+ if (method == null) method = 'POST';
70
+ path = '/' + '_reindex' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle';
59
71
 
60
72
  // build request object
61
73
  const request = {
62
74
  method,
63
75
  path,
64
76
  body: body || '',
65
- querystring
66
- }
77
+ querystring,
78
+ };
67
79
 
68
- return this.transport.request(request, options, callback)
80
+ return this.transport.request(request, options, callback);
69
81
  }
70
82
 
71
- module.exports = reindexRethrottleApi
83
+ module.exports = reindexRethrottleApi;
@@ -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,28 +27,28 @@
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 = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path'];
37
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' };
39
38
 
40
- function renderSearchTemplateApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
39
+ function renderSearchTemplateApi(params, options, callback) {
40
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
41
 
43
- let { method, body, id, ...querystring } = params
44
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
42
+ let { method, body, id, ...querystring } = params;
43
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
45
44
 
46
- let path = ''
47
- if ((id) != null) {
48
- if (method == null) method = body == null ? 'GET' : 'POST'
49
- path = '/' + '_render' + '/' + 'template' + '/' + encodeURIComponent(id)
45
+ let path = '';
46
+ if (id != null) {
47
+ if (method == null) method = body == null ? 'GET' : 'POST';
48
+ path = '/' + '_render' + '/' + 'template' + '/' + encodeURIComponent(id);
50
49
  } else {
51
- if (method == null) method = body == null ? 'GET' : 'POST'
52
- path = '/' + '_render' + '/' + 'template'
50
+ if (method == null) method = body == null ? 'GET' : 'POST';
51
+ path = '/' + '_render' + '/' + 'template';
53
52
  }
54
53
 
55
54
  // build request object
@@ -57,10 +56,10 @@ function renderSearchTemplateApi (params, options, callback) {
57
56
  method,
58
57
  path,
59
58
  body: body || '',
60
- querystring
61
- }
59
+ querystring,
60
+ };
62
61
 
63
- return this.transport.request(request, options, callback)
62
+ return this.transport.request(request, options, callback);
64
63
  }
65
64
 
66
- module.exports = renderSearchTemplateApi
65
+ module.exports = renderSearchTemplateApi;
@@ -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,34 +27,34 @@
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 = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path'];
37
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' };
39
38
 
40
- function scriptsPainlessExecuteApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
39
+ function scriptsPainlessExecuteApi(params, options, callback) {
40
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
41
 
43
- let { method, body, ...querystring } = params
44
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
42
+ let { method, body, ...querystring } = params;
43
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
45
44
 
46
- let path = ''
47
- if (method == null) method = body == null ? 'GET' : 'POST'
48
- path = '/' + '_scripts' + '/' + 'painless' + '/' + '_execute'
45
+ let path = '';
46
+ if (method == null) method = body == null ? 'GET' : 'POST';
47
+ path = '/' + '_scripts' + '/' + 'painless' + '/' + '_execute';
49
48
 
50
49
  // build request object
51
50
  const request = {
52
51
  method,
53
52
  path,
54
53
  body: body || '',
55
- querystring
56
- }
54
+ querystring,
55
+ };
57
56
 
58
- return this.transport.request(request, options, callback)
57
+ return this.transport.request(request, options, callback);
59
58
  }
60
59
 
61
- module.exports = scriptsPainlessExecuteApi
60
+ module.exports = scriptsPainlessExecuteApi;
package/api/api/scroll.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,28 +27,42 @@
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 = ['scroll', 'scroll_id', 'rest_total_hits_as_int', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { scrollId: 'scroll_id', restTotalHitsAsInt: 'rest_total_hits_as_int', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'scroll',
38
+ 'scroll_id',
39
+ 'rest_total_hits_as_int',
40
+ 'pretty',
41
+ 'human',
42
+ 'error_trace',
43
+ 'source',
44
+ 'filter_path',
45
+ ];
46
+ const snakeCase = {
47
+ scrollId: 'scroll_id',
48
+ restTotalHitsAsInt: 'rest_total_hits_as_int',
49
+ errorTrace: 'error_trace',
50
+ filterPath: 'filter_path',
51
+ };
39
52
 
40
- function scrollApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
53
+ function scrollApi(params, options, callback) {
54
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
55
 
43
- let { method, body, scrollId, scroll_id, ...querystring } = params
44
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
56
+ let { method, body, scrollId, scroll_id, ...querystring } = params;
57
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
45
58
 
46
- let path = ''
59
+ let path = '';
47
60
  if ((scroll_id || scrollId) != null) {
48
- if (method == null) method = body == null ? 'GET' : 'POST'
49
- path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId)
61
+ if (method == null) method = body == null ? 'GET' : 'POST';
62
+ path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId);
50
63
  } else {
51
- if (method == null) method = body == null ? 'GET' : 'POST'
52
- path = '/' + '_search' + '/' + 'scroll'
64
+ if (method == null) method = body == null ? 'GET' : 'POST';
65
+ path = '/' + '_search' + '/' + 'scroll';
53
66
  }
54
67
 
55
68
  // build request object
@@ -57,10 +70,10 @@ function scrollApi (params, options, callback) {
57
70
  method,
58
71
  path,
59
72
  body: body || '',
60
- querystring
61
- }
73
+ querystring,
74
+ };
62
75
 
63
- return this.transport.request(request, options, callback)
76
+ return this.transport.request(request, options, callback);
64
77
  }
65
78
 
66
- module.exports = scrollApi
79
+ module.exports = scrollApi;