@opensearch-project/opensearch 2.1.0 → 2.2.1

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 (83) hide show
  1. package/.eslintrc.json +4 -1
  2. package/CHANGELOG.md +125 -6
  3. package/DEVELOPER_GUIDE.md +55 -5
  4. package/MAINTAINERS.md +10 -6
  5. package/RELEASING.md +8 -1
  6. package/USER_GUIDE.md +133 -63
  7. package/api/api/bulk.js +23 -0
  8. package/api/api/cat.js +319 -0
  9. package/api/api/clear_scroll.js +14 -0
  10. package/api/api/cluster.js +237 -0
  11. package/api/api/count.js +28 -0
  12. package/api/api/create.js +26 -0
  13. package/api/api/create_pit.js +88 -0
  14. package/api/api/dangling_indices.js +45 -0
  15. package/api/api/delete.js +23 -0
  16. package/api/api/delete_all_pits.js +53 -0
  17. package/api/api/delete_by_query.js +48 -0
  18. package/api/api/delete_by_query_rethrottle.js +14 -0
  19. package/api/api/delete_pit.js +61 -0
  20. package/api/api/delete_script.js +14 -0
  21. package/api/api/exists.js +25 -0
  22. package/api/api/exists_source.js +25 -0
  23. package/api/api/explain.js +27 -0
  24. package/api/api/features.js +24 -0
  25. package/api/api/field_caps.js +19 -0
  26. package/api/api/get.js +25 -0
  27. package/api/api/get_all_pits.js +53 -0
  28. package/api/api/get_script.js +16 -0
  29. package/api/api/get_script_context.js +11 -0
  30. package/api/api/get_script_languages.js +11 -0
  31. package/api/api/get_source.js +25 -0
  32. package/api/api/index.js +29 -0
  33. package/api/api/indices.js +815 -0
  34. package/api/api/info.js +11 -0
  35. package/api/api/ingest.js +89 -0
  36. package/api/api/mget.js +24 -0
  37. package/api/api/msearch.js +22 -0
  38. package/api/api/msearch_template.js +19 -0
  39. package/api/api/nodes.js +91 -0
  40. package/api/api/ping.js +11 -0
  41. package/api/api/put_script.js +17 -0
  42. package/api/api/rank_eval.js +19 -0
  43. package/api/api/reindex.js +22 -0
  44. package/api/api/reindex_rethrottle.js +14 -0
  45. package/api/api/render_search_template.js +14 -0
  46. package/api/api/scripts_painless_execute.js +13 -0
  47. package/api/api/scroll.js +17 -0
  48. package/api/api/search.js +60 -0
  49. package/api/api/search_shards.js +19 -0
  50. package/api/api/search_template.js +27 -0
  51. package/api/api/shutdown.js +3 -0
  52. package/api/api/snapshot.js +210 -0
  53. package/api/api/tasks.js +56 -0
  54. package/api/api/terms_enum.js +1 -0
  55. package/api/api/termvectors.js +26 -0
  56. package/api/api/update.js +28 -0
  57. package/api/api/update_by_query.js +50 -0
  58. package/api/api/update_by_query_rethrottle.js +14 -0
  59. package/api/index.js +28 -0
  60. package/api/new.d.ts +64 -0
  61. package/api/opensearch_dashboards.d.ts +4 -0
  62. package/api/requestParams.d.ts +16 -0
  63. package/api/types.d.ts +53 -6
  64. package/guides/advanced_index_actions.md +91 -0
  65. package/guides/bulk.md +166 -0
  66. package/guides/document_lifecycle.md +162 -0
  67. package/guides/index_lifecycle.md +152 -0
  68. package/guides/index_template.md +228 -0
  69. package/guides/search.md +217 -0
  70. package/index.d.ts +160 -0
  71. package/jenkins/release.JenkinsFile +2 -2
  72. package/lib/Connection.js +1 -1
  73. package/lib/Serializer.js +2 -2
  74. package/lib/Transport.js +23 -1
  75. package/lib/aws/AwsSigv4Signer.js +14 -5
  76. package/lib/aws/index.d.ts +1 -0
  77. package/lib/errors.d.ts +2 -2
  78. package/lib/errors.js +2 -2
  79. package/lib/pool/BaseConnectionPool.js +18 -9
  80. package/lib/pool/CloudConnectionPool.js +2 -2
  81. package/lib/pool/ConnectionPool.js +4 -4
  82. package/lib/pool/index.d.ts +35 -6
  83. package/package.json +13 -12
@@ -73,7 +73,7 @@ class ConnectionPool extends BaseConnectionPool {
73
73
 
74
74
  /**
75
75
  * Marks a connection as 'dead'.
76
- * If needed adds the connection to the dead list
76
+ * If needed, adds the connection to the dead list
77
77
  * and then increments the `deadCount`.
78
78
  *
79
79
  * @param {object} connection
@@ -82,9 +82,9 @@ class ConnectionPool extends BaseConnectionPool {
82
82
  const { id } = connection;
83
83
  debug(`Marking as 'dead' connection '${id}'`);
84
84
  if (this.dead.indexOf(id) === -1) {
85
- // It might happen that `markDead` is called jsut after
85
+ // It might happen that `markDead` is called just after
86
86
  // a pool update, and in such case we will add to the dead
87
- // list a node that no longer exist. The following check verify
87
+ // list a node that no longer exists. The following check verifies
88
88
  // that the connection is still part of the pool before
89
89
  // marking it as dead.
90
90
  for (let i = 0; i < this.size; i++) {
@@ -227,7 +227,7 @@ class ConnectionPool extends BaseConnectionPool {
227
227
  *
228
228
  * @returns {ConnectionPool}
229
229
  */
230
- empty(callback) {
230
+ empty(callback = noop) {
231
231
  super.empty(() => {
232
232
  this.dead = [];
233
233
  callback();
@@ -31,7 +31,7 @@
31
31
 
32
32
  import { URL } from 'url';
33
33
  import { SecureContextOptions } from 'tls';
34
- import Connection, { AgentOptions } from '../Connection';
34
+ import Connection, { AgentOptions, ConnectionOptions } from '../Connection';
35
35
  import { nodeFilterFn, nodeSelectorFn } from '../Transport';
36
36
 
37
37
  interface BaseConnectionPoolOptions {
@@ -115,13 +115,20 @@ declare class BaseConnectionPool {
115
115
  * @returns {object|null} connection
116
116
  */
117
117
  getConnection(opts?: getConnectionOptions): Connection | null;
118
+
119
+ /**
120
+ * Creates a new connection instance.
121
+ * @param {object|string} opts
122
+ * @returns {Connection}
123
+ */
124
+ createConnection(opts: ConnectionOptions | string): Connection;
118
125
  /**
119
126
  * Adds a new connection to the pool.
120
127
  *
121
128
  * @param {object|string} host
122
129
  * @returns {ConnectionPool}
123
130
  */
124
- addConnection(opts: any): Connection;
131
+ addConnection(opts: string | ConnectionOptions | ConnectionOptions[]): Connection;
125
132
  /**
126
133
  * Removes a new connection to the pool.
127
134
  *
@@ -132,16 +139,15 @@ declare class BaseConnectionPool {
132
139
  /**
133
140
  * Empties the connection pool.
134
141
  *
135
- * @returns {ConnectionPool}
136
142
  */
137
- empty(): this;
143
+ empty(callback?: () => void): void;
138
144
  /**
139
145
  * Update the ConnectionPool with new connections.
140
146
  *
141
147
  * @param {array} array of connections
142
148
  * @returns {ConnectionPool}
143
149
  */
144
- update(connections: any[]): this;
150
+ update(connections: Connection[]): this;
145
151
  /**
146
152
  * Transforms the nodes objects to a host object.
147
153
  *
@@ -155,7 +161,7 @@ declare class BaseConnectionPool {
155
161
  * @param {string} url
156
162
  * @returns {object} host
157
163
  */
158
- urlToHost(url: string): { url: URL };
164
+ urlToHost(url: string): ConnectionOptions;
159
165
  }
160
166
 
161
167
  declare class ConnectionPool extends BaseConnectionPool {
@@ -183,12 +189,35 @@ declare class ConnectionPool extends BaseConnectionPool {
183
189
  opts: resurrectOptions,
184
190
  callback?: (isAlive: boolean | null, connection: Connection | null) => void
185
191
  ): void;
192
+
193
+ /**
194
+ * Empties the connection pool.
195
+ */
196
+ empty(callback?: () => void): void;
197
+ /**
198
+ * Update the ConnectionPool with new connections.
199
+ *
200
+ * @param {array} array of connections
201
+ * @returns {ConnectionPool}
202
+ */
203
+ update(connections: Connection[]): this;
186
204
  }
187
205
 
188
206
  declare class CloudConnectionPool extends BaseConnectionPool {
189
207
  cloudConnection: Connection | null;
190
208
  constructor(opts?: BaseConnectionPoolOptions);
191
209
  getConnection(): Connection | null;
210
+ /**
211
+ * Empties the connection pool.
212
+ */
213
+ empty(callback?: () => void): void;
214
+ /**
215
+ * Update the ConnectionPool with new connections.
216
+ *
217
+ * @param {array} array of connections
218
+ * @returns {ConnectionPool}
219
+ */
220
+ update(connections: Connection[]): this;
192
221
  }
193
222
 
194
223
  declare function defaultNodeFilter(node: Connection): boolean;
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "import": "./index.mjs"
11
11
  },
12
12
  "./aws": "./lib/aws/index.js",
13
- "./": "./"
13
+ "./*": "./*"
14
14
  },
15
15
  "typesVersions": {
16
16
  "*": {
@@ -23,7 +23,7 @@
23
23
  }
24
24
  },
25
25
  "homepage": "https://www.opensearch.org/",
26
- "version": "2.1.0",
26
+ "version": "2.2.1",
27
27
  "versionCanary": "7.10.0-canary.6",
28
28
  "keywords": [
29
29
  "opensearch",
@@ -57,42 +57,43 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@aws-sdk/types": "^3.160.0",
60
+ "@babel/eslint-parser": "^7.19.1",
60
61
  "@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1",
61
- "@types/node": "^15.3.1",
62
- "babel-eslint": "^10.1.0",
62
+ "@types/node": "^18.15.3",
63
63
  "convert-hrtime": "^5.0.0",
64
64
  "cross-zip": "^4.0.0",
65
65
  "dedent": "^0.7.0",
66
66
  "deepmerge": "^4.2.2",
67
67
  "dezalgo": "^1.0.3",
68
- "eslint": "^7.32.0",
68
+ "eslint": "^8.30.0",
69
69
  "eslint-config-prettier": "^8.5.0",
70
70
  "eslint-plugin-prettier": "^4.0.0",
71
71
  "fast-deep-equal": "^3.1.3",
72
72
  "into-stream": "^6.0.0",
73
73
  "js-yaml": "^4.1.0",
74
+ "jsdoc": "^4.0.0",
74
75
  "license-checker": "^25.0.1",
75
76
  "minimist": "^1.2.5",
76
77
  "node-fetch": "^3.2.10",
77
- "ora": "^5.4.0",
78
+ "ora": "^6.1.2",
78
79
  "prettier": "^2.6.2",
79
80
  "pretty-hrtime": "^1.0.3",
80
81
  "proxy": "^1.0.2",
81
- "rimraf": "^3.0.2",
82
+ "rimraf": "^5.0.0",
82
83
  "semver": "^7.3.5",
83
- "simple-git": "^3.5.0",
84
+ "simple-git": "^3.15.0",
84
85
  "simple-statistics": "^7.7.0",
85
- "split2": "^3.2.2",
86
+ "split2": "^4.1.0",
86
87
  "stoppable": "^1.1.0",
87
88
  "tap": "^16.3.0",
88
- "tsd": "^0.24.1",
89
+ "tsd": "^0.27.0",
89
90
  "workq": "^3.0.0",
90
- "xmlbuilder2": "^2.4.1"
91
+ "xmlbuilder2": "^3.0.2"
91
92
  },
92
93
  "dependencies": {
93
94
  "aws4": "^1.11.0",
94
95
  "debug": "^4.3.1",
95
- "hpagent": "^0.1.1",
96
+ "hpagent": "^1.2.0",
96
97
  "ms": "^2.1.3",
97
98
  "secure-json-parse": "^2.4.0"
98
99
  },