@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.
Files changed (86) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.json +26 -0
  3. package/.prettierrc.json +5 -0
  4. package/.whitesource +15 -0
  5. package/ADMINS.md +18 -11
  6. package/COMPATIBILITY.md +24 -0
  7. package/DEVELOPER_GUIDE.md +22 -5
  8. package/MAINTAINERS.md +23 -18
  9. package/README.md +102 -106
  10. package/RELEASING.md +3 -3
  11. package/SECURITY.md +1 -1
  12. package/api/api/bulk.js +53 -26
  13. package/api/api/cat.js +354 -264
  14. package/api/api/clear_scroll.js +17 -17
  15. package/api/api/cluster.js +366 -219
  16. package/api/api/count.js +55 -24
  17. package/api/api/create.js +50 -24
  18. package/api/api/dangling_indices.js +95 -51
  19. package/api/api/delete.js +49 -22
  20. package/api/api/delete_by_query.js +88 -25
  21. package/api/api/delete_by_query_rethrottle.js +33 -19
  22. package/api/api/delete_script.js +31 -17
  23. package/api/api/exists.js +55 -22
  24. package/api/api/exists_source.js +60 -27
  25. package/api/api/explain.js +60 -22
  26. package/api/api/features.js +56 -35
  27. package/api/api/field_caps.js +36 -18
  28. package/api/api/get.js +55 -22
  29. package/api/api/get_script.js +30 -17
  30. package/api/api/get_script_context.js +15 -15
  31. package/api/api/get_script_languages.js +15 -15
  32. package/api/api/get_source.js +55 -22
  33. package/api/api/index.js +60 -28
  34. package/api/api/indices.js +1068 -857
  35. package/api/api/info.js +15 -15
  36. package/api/api/ingest.js +132 -96
  37. package/api/api/mget.js +50 -26
  38. package/api/api/msearch.js +49 -26
  39. package/api/api/msearch_template.js +53 -26
  40. package/api/api/mtermvectors.js +48 -24
  41. package/api/api/nodes.js +281 -154
  42. package/api/api/ping.js +15 -15
  43. package/api/api/put_script.js +40 -25
  44. package/api/api/rank_eval.js +37 -20
  45. package/api/api/reindex.js +38 -17
  46. package/api/api/reindex_rethrottle.js +32 -19
  47. package/api/api/render_search_template.js +18 -18
  48. package/api/api/scripts_painless_execute.js +15 -15
  49. package/api/api/scroll.js +31 -17
  50. package/api/api/search.js +108 -24
  51. package/api/api/search_shards.js +36 -18
  52. package/api/api/search_template.js +64 -26
  53. package/api/api/shutdown.js +66 -54
  54. package/api/api/snapshot.js +347 -224
  55. package/api/api/tasks.js +65 -46
  56. package/api/api/terms_enum.js +17 -17
  57. package/api/api/termvectors.js +57 -26
  58. package/api/api/update.js +64 -24
  59. package/api/api/update_by_query.js +89 -23
  60. package/api/api/update_by_query_rethrottle.js +33 -19
  61. package/api/index.js +267 -179
  62. package/api/new.d.ts +2042 -529
  63. package/api/opensearch_dashboards.d.ts +275 -0
  64. package/api/requestParams.d.ts +301 -69
  65. package/api/types.d.ts +6204 -5719
  66. package/api/utils.js +22 -22
  67. package/codecov.yml +2 -2
  68. package/index.d.ts +4779 -934
  69. package/index.js +153 -140
  70. package/index.mjs +9 -9
  71. package/lib/Connection.d.ts +37 -26
  72. package/lib/Connection.js +163 -168
  73. package/lib/Helpers.d.ts +103 -63
  74. package/lib/Helpers.js +398 -371
  75. package/lib/Serializer.d.ts +2 -2
  76. package/lib/Serializer.js +39 -39
  77. package/lib/Transport.d.ts +30 -12
  78. package/lib/Transport.js +383 -324
  79. package/lib/errors.d.ts +25 -7
  80. package/lib/errors.js +75 -71
  81. package/lib/pool/BaseConnectionPool.js +100 -97
  82. package/lib/pool/CloudConnectionPool.js +16 -16
  83. package/lib/pool/ConnectionPool.js +105 -105
  84. package/lib/pool/index.d.ts +8 -6
  85. package/lib/pool/index.js +6 -6
  86. package/package.json +13 -8
package/api/api/bulk.js CHANGED
@@ -28,43 +28,70 @@
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 = ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'type', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'pipeline', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' }
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
37
+ const acceptedQuerystring = [
38
+ 'wait_for_active_shards',
39
+ 'refresh',
40
+ 'routing',
41
+ 'timeout',
42
+ 'type',
43
+ '_source',
44
+ '_source_excludes',
45
+ '_source_exclude',
46
+ '_source_includes',
47
+ '_source_include',
48
+ 'pipeline',
49
+ 'require_alias',
50
+ 'pretty',
51
+ 'human',
52
+ 'error_trace',
53
+ 'source',
54
+ 'filter_path',
55
+ ];
56
+ const snakeCase = {
57
+ waitForActiveShards: 'wait_for_active_shards',
58
+ _sourceExcludes: '_source_excludes',
59
+ _sourceExclude: '_source_exclude',
60
+ _sourceIncludes: '_source_includes',
61
+ _sourceInclude: '_source_include',
62
+ requireAlias: 'require_alias',
63
+ errorTrace: 'error_trace',
64
+ filterPath: 'filter_path',
65
+ };
39
66
 
40
- function bulkApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
67
+ function bulkApi(params, options, callback) {
68
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
69
 
43
70
  // check required parameters
44
71
  if (params.body == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: body')
46
- return handleError(err, callback)
72
+ const err = new this[kConfigurationError]('Missing required parameter: body');
73
+ return handleError(err, callback);
47
74
  }
48
75
 
49
76
  // 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)
77
+ if (params.type != null && params.index == null) {
78
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index');
79
+ return handleError(err, callback);
53
80
  }
54
81
 
55
- let { method, body, index, type, ...querystring } = params
56
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
82
+ let { method, body, index, type, ...querystring } = params;
83
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
57
84
 
58
- let path = ''
59
- if ((index) != null && (type) != null) {
60
- if (method == null) method = 'POST'
61
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_bulk'
62
- } else if ((index) != null) {
63
- if (method == null) method = 'POST'
64
- path = '/' + encodeURIComponent(index) + '/' + '_bulk'
85
+ let path = '';
86
+ if (index != null && type != null) {
87
+ if (method == null) method = 'POST';
88
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_bulk';
89
+ } else if (index != null) {
90
+ if (method == null) method = 'POST';
91
+ path = '/' + encodeURIComponent(index) + '/' + '_bulk';
65
92
  } else {
66
- if (method == null) method = 'POST'
67
- path = '/' + '_bulk'
93
+ if (method == null) method = 'POST';
94
+ path = '/' + '_bulk';
68
95
  }
69
96
 
70
97
  // build request object
@@ -72,10 +99,10 @@ function bulkApi (params, options, callback) {
72
99
  method,
73
100
  path,
74
101
  bulkBody: body,
75
- querystring
76
- }
102
+ querystring,
103
+ };
77
104
 
78
- return this.transport.request(request, options, callback)
105
+ return this.transport.request(request, options, callback);
79
106
  }
80
107
 
81
- module.exports = bulkApi
108
+ module.exports = bulkApi;