@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,43 +27,70 @@
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 = ['search_type', 'typed_keys', 'max_concurrent_searches', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { searchType: 'search_type', typedKeys: 'typed_keys', maxConcurrentSearches: 'max_concurrent_searches', restTotalHitsAsInt: 'rest_total_hits_as_int', ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'search_type',
38
+ 'typed_keys',
39
+ 'max_concurrent_searches',
40
+ 'rest_total_hits_as_int',
41
+ 'ccs_minimize_roundtrips',
42
+ 'pretty',
43
+ 'human',
44
+ 'error_trace',
45
+ 'source',
46
+ 'filter_path',
47
+ ];
48
+ const snakeCase = {
49
+ searchType: 'search_type',
50
+ typedKeys: 'typed_keys',
51
+ maxConcurrentSearches: 'max_concurrent_searches',
52
+ restTotalHitsAsInt: 'rest_total_hits_as_int',
53
+ ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips',
54
+ errorTrace: 'error_trace',
55
+ filterPath: 'filter_path',
56
+ };
39
57
 
40
- function msearchTemplateApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
58
+ function msearchTemplateApi(params, options, callback) {
59
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
60
 
43
61
  // check required parameters
44
62
  if (params.body == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: body')
46
- return handleError(err, callback)
63
+ const err = new this[kConfigurationError]('Missing required parameter: body');
64
+ return handleError(err, callback);
47
65
  }
48
66
 
49
67
  // check required url components
50
- if (params.type != null && (params.index == null)) {
51
- const err = new this[kConfigurationError]('Missing required parameter of the url: index')
52
- return handleError(err, callback)
68
+ if (params.type != null && params.index == null) {
69
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index');
70
+ return handleError(err, callback);
53
71
  }
54
72
 
55
- let { method, body, index, type, ...querystring } = params
56
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
73
+ let { method, body, index, type, ...querystring } = params;
74
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
57
75
 
58
- let path = ''
59
- if ((index) != null && (type) != null) {
60
- if (method == null) method = body == null ? 'GET' : 'POST'
61
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' + '/' + 'template'
62
- } else if ((index) != null) {
63
- if (method == null) method = body == null ? 'GET' : 'POST'
64
- path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template'
76
+ let path = '';
77
+ if (index != null && type != null) {
78
+ if (method == null) method = body == null ? 'GET' : 'POST';
79
+ path =
80
+ '/' +
81
+ encodeURIComponent(index) +
82
+ '/' +
83
+ encodeURIComponent(type) +
84
+ '/' +
85
+ '_msearch' +
86
+ '/' +
87
+ 'template';
88
+ } else if (index != null) {
89
+ if (method == null) method = body == null ? 'GET' : 'POST';
90
+ path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template';
65
91
  } else {
66
- if (method == null) method = body == null ? 'GET' : 'POST'
67
- path = '/' + '_msearch' + '/' + 'template'
92
+ if (method == null) method = body == null ? 'GET' : 'POST';
93
+ path = '/' + '_msearch' + '/' + 'template';
68
94
  }
69
95
 
70
96
  // build request object
@@ -72,10 +98,10 @@ function msearchTemplateApi (params, options, callback) {
72
98
  method,
73
99
  path,
74
100
  bulkBody: body,
75
- querystring
76
- }
101
+ querystring,
102
+ };
77
103
 
78
- return this.transport.request(request, options, callback)
104
+ return this.transport.request(request, options, callback);
79
105
  }
80
106
 
81
- module.exports = msearchTemplateApi
107
+ module.exports = msearchTemplateApi;
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -28,37 +27,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 = ['ids', 'term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { termStatistics: 'term_statistics', fieldStatistics: 'field_statistics', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'ids',
38
+ 'term_statistics',
39
+ 'field_statistics',
40
+ 'fields',
41
+ 'offsets',
42
+ 'positions',
43
+ 'payloads',
44
+ 'preference',
45
+ 'routing',
46
+ 'realtime',
47
+ 'version',
48
+ 'version_type',
49
+ 'pretty',
50
+ 'human',
51
+ 'error_trace',
52
+ 'source',
53
+ 'filter_path',
54
+ ];
55
+ const snakeCase = {
56
+ termStatistics: 'term_statistics',
57
+ fieldStatistics: 'field_statistics',
58
+ versionType: 'version_type',
59
+ errorTrace: 'error_trace',
60
+ filterPath: 'filter_path',
61
+ };
39
62
 
40
- function mtermvectorsApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
63
+ function mtermvectorsApi(params, options, callback) {
64
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
65
 
43
66
  // check required url components
44
- if (params.type != null && (params.index == null)) {
45
- const err = new this[kConfigurationError]('Missing required parameter of the url: index')
46
- return handleError(err, callback)
67
+ if (params.type != null && params.index == null) {
68
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index');
69
+ return handleError(err, callback);
47
70
  }
48
71
 
49
- let { method, body, index, type, ...querystring } = params
50
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
72
+ let { method, body, index, type, ...querystring } = params;
73
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
51
74
 
52
- let path = ''
53
- if ((index) != null && (type) != null) {
54
- if (method == null) method = body == null ? 'GET' : 'POST'
55
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mtermvectors'
56
- } else if ((index) != null) {
57
- if (method == null) method = body == null ? 'GET' : 'POST'
58
- path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors'
75
+ let path = '';
76
+ if (index != null && type != null) {
77
+ if (method == null) method = body == null ? 'GET' : 'POST';
78
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mtermvectors';
79
+ } else if (index != null) {
80
+ if (method == null) method = body == null ? 'GET' : 'POST';
81
+ path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors';
59
82
  } else {
60
- if (method == null) method = body == null ? 'GET' : 'POST'
61
- path = '/' + '_mtermvectors'
83
+ if (method == null) method = body == null ? 'GET' : 'POST';
84
+ path = '/' + '_mtermvectors';
62
85
  }
63
86
 
64
87
  // build request object
@@ -66,10 +89,10 @@ function mtermvectorsApi (params, options, callback) {
66
89
  method,
67
90
  path,
68
91
  body: body || '',
69
- querystring
70
- }
92
+ querystring,
93
+ };
71
94
 
72
- return this.transport.request(request, options, callback)
95
+ return this.transport.request(request, options, callback);
73
96
  }
74
97
 
75
- module.exports = mtermvectorsApi
98
+ module.exports = mtermvectorsApi;