@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,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 getScriptLanguagesApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
39
+ function getScriptLanguagesApi(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 = 'GET'
48
- path = '/' + '_script_language'
45
+ let path = '';
46
+ if (method == null) method = 'GET';
47
+ path = '/' + '_script_language';
49
48
 
50
49
  // build request object
51
50
  const request = {
52
51
  method,
53
52
  path,
54
53
  body: null,
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 = getScriptLanguagesApi
60
+ module.exports = getScriptLanguagesApi;
@@ -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,38 +27,71 @@
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 = ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'preference',
38
+ 'realtime',
39
+ 'refresh',
40
+ 'routing',
41
+ '_source',
42
+ '_source_excludes',
43
+ '_source_exclude',
44
+ '_source_includes',
45
+ '_source_include',
46
+ 'version',
47
+ 'version_type',
48
+ 'pretty',
49
+ 'human',
50
+ 'error_trace',
51
+ 'source',
52
+ 'filter_path',
53
+ ];
54
+ const snakeCase = {
55
+ _sourceExcludes: '_source_excludes',
56
+ _sourceExclude: '_source_exclude',
57
+ _sourceIncludes: '_source_includes',
58
+ _sourceInclude: '_source_include',
59
+ versionType: 'version_type',
60
+ errorTrace: 'error_trace',
61
+ filterPath: 'filter_path',
62
+ };
39
63
 
40
- function getSourceApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
64
+ function getSourceApi(params, options, callback) {
65
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
66
 
43
67
  // check required parameters
44
68
  if (params.id == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: id')
46
- return handleError(err, callback)
69
+ const err = new this[kConfigurationError]('Missing required parameter: id');
70
+ return handleError(err, callback);
47
71
  }
48
72
  if (params.index == null) {
49
- const err = new this[kConfigurationError]('Missing required parameter: index')
50
- return handleError(err, callback)
73
+ const err = new this[kConfigurationError]('Missing required parameter: index');
74
+ return handleError(err, callback);
51
75
  }
52
76
 
53
- let { method, body, id, index, type, ...querystring } = params
54
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
77
+ let { method, body, id, index, type, ...querystring } = params;
78
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
55
79
 
56
- let path = ''
57
- if ((index) != null && (type) != null && (id) != null) {
58
- if (method == null) method = 'GET'
59
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
80
+ let path = '';
81
+ if (index != null && type != null && id != null) {
82
+ if (method == null) method = 'GET';
83
+ path =
84
+ '/' +
85
+ encodeURIComponent(index) +
86
+ '/' +
87
+ encodeURIComponent(type) +
88
+ '/' +
89
+ encodeURIComponent(id) +
90
+ '/' +
91
+ '_source';
60
92
  } else {
61
- if (method == null) method = 'GET'
62
- path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
93
+ if (method == null) method = 'GET';
94
+ path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id);
63
95
  }
64
96
 
65
97
  // build request object
@@ -67,10 +99,10 @@ function getSourceApi (params, options, callback) {
67
99
  method,
68
100
  path,
69
101
  body: null,
70
- querystring
71
- }
102
+ querystring,
103
+ };
72
104
 
73
- return this.transport.request(request, options, callback)
105
+ return this.transport.request(request, options, callback);
74
106
  }
75
107
 
76
- module.exports = getSourceApi
108
+ module.exports = getSourceApi;
package/api/api/index.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,44 +27,76 @@
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 = ['wait_for_active_shards', 'op_type', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'if_seq_no', 'if_primary_term', 'pipeline', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { waitForActiveShards: 'wait_for_active_shards', opType: 'op_type', versionType: 'version_type', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'wait_for_active_shards',
38
+ 'op_type',
39
+ 'refresh',
40
+ 'routing',
41
+ 'timeout',
42
+ 'version',
43
+ 'version_type',
44
+ 'if_seq_no',
45
+ 'if_primary_term',
46
+ 'pipeline',
47
+ 'require_alias',
48
+ 'pretty',
49
+ 'human',
50
+ 'error_trace',
51
+ 'source',
52
+ 'filter_path',
53
+ ];
54
+ const snakeCase = {
55
+ waitForActiveShards: 'wait_for_active_shards',
56
+ opType: 'op_type',
57
+ versionType: 'version_type',
58
+ ifSeqNo: 'if_seq_no',
59
+ ifPrimaryTerm: 'if_primary_term',
60
+ requireAlias: 'require_alias',
61
+ errorTrace: 'error_trace',
62
+ filterPath: 'filter_path',
63
+ };
39
64
 
40
- function indexApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
65
+ function indexApi(params, options, callback) {
66
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
67
 
43
68
  // check required parameters
44
69
  if (params.index == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: index')
46
- return handleError(err, callback)
70
+ const err = new this[kConfigurationError]('Missing required parameter: index');
71
+ return handleError(err, callback);
47
72
  }
48
73
  if (params.body == null) {
49
- const err = new this[kConfigurationError]('Missing required parameter: body')
50
- return handleError(err, callback)
74
+ const err = new this[kConfigurationError]('Missing required parameter: body');
75
+ return handleError(err, callback);
51
76
  }
52
77
 
53
- let { method, body, id, index, type, ...querystring } = params
54
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
78
+ let { method, body, id, index, type, ...querystring } = params;
79
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
55
80
 
56
- let path = ''
57
- if ((index) != null && (type) != null && (id) != null) {
58
- if (method == null) method = 'PUT'
59
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
60
- } else if ((index) != null && (id) != null) {
61
- if (method == null) method = 'PUT'
62
- path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
63
- } else if ((index) != null && (type) != null) {
64
- if (method == null) method = 'POST'
65
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type)
81
+ let path = '';
82
+ if (index != null && type != null && id != null) {
83
+ if (method == null) method = 'PUT';
84
+ path =
85
+ '/' +
86
+ encodeURIComponent(index) +
87
+ '/' +
88
+ encodeURIComponent(type) +
89
+ '/' +
90
+ encodeURIComponent(id);
91
+ } else if (index != null && id != null) {
92
+ if (method == null) method = 'PUT';
93
+ path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id);
94
+ } else if (index != null && type != null) {
95
+ if (method == null) method = 'POST';
96
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type);
66
97
  } else {
67
- if (method == null) method = 'POST'
68
- path = '/' + encodeURIComponent(index) + '/' + '_doc'
98
+ if (method == null) method = 'POST';
99
+ path = '/' + encodeURIComponent(index) + '/' + '_doc';
69
100
  }
70
101
 
71
102
  // build request object
@@ -73,10 +104,10 @@ function indexApi (params, options, callback) {
73
104
  method,
74
105
  path,
75
106
  body: body || '',
76
- querystring
77
- }
107
+ querystring,
108
+ };
78
109
 
79
- return this.transport.request(request, options, callback)
110
+ return this.transport.request(request, options, callback);
80
111
  }
81
112
 
82
- module.exports = indexApi
113
+ module.exports = indexApi;