@opensearch-project/opensearch 2.1.0 → 2.2.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.
- package/.eslintrc.json +4 -1
- package/CHANGELOG.md +40 -10
- package/MAINTAINERS.md +4 -6
- package/RELEASING.md +7 -1
- package/USER_GUIDE.md +112 -61
- package/api/api/bulk.js +23 -0
- package/api/api/cat.js +319 -0
- package/api/api/clear_scroll.js +14 -0
- package/api/api/cluster.js +237 -0
- package/api/api/count.js +28 -0
- package/api/api/create.js +26 -0
- package/api/api/create_pit.js +88 -0
- package/api/api/dangling_indices.js +45 -0
- package/api/api/delete.js +23 -0
- package/api/api/delete_all_pits.js +53 -0
- package/api/api/delete_by_query.js +48 -0
- package/api/api/delete_by_query_rethrottle.js +14 -0
- package/api/api/delete_pit.js +61 -0
- package/api/api/delete_script.js +14 -0
- package/api/api/exists.js +25 -0
- package/api/api/exists_source.js +25 -0
- package/api/api/explain.js +27 -0
- package/api/api/features.js +24 -0
- package/api/api/field_caps.js +19 -0
- package/api/api/get.js +25 -0
- package/api/api/get_all_pits.js +53 -0
- package/api/api/get_script.js +16 -0
- package/api/api/get_script_context.js +11 -0
- package/api/api/get_script_languages.js +11 -0
- package/api/api/get_source.js +25 -0
- package/api/api/index.js +29 -0
- package/api/api/indices.js +815 -0
- package/api/api/info.js +11 -0
- package/api/api/ingest.js +89 -0
- package/api/api/mget.js +24 -0
- package/api/api/msearch.js +22 -0
- package/api/api/msearch_template.js +19 -0
- package/api/api/nodes.js +91 -0
- package/api/api/ping.js +11 -0
- package/api/api/put_script.js +17 -0
- package/api/api/rank_eval.js +19 -0
- package/api/api/reindex.js +22 -0
- package/api/api/reindex_rethrottle.js +14 -0
- package/api/api/render_search_template.js +14 -0
- package/api/api/scripts_painless_execute.js +13 -0
- package/api/api/scroll.js +17 -0
- package/api/api/search.js +60 -0
- package/api/api/search_shards.js +19 -0
- package/api/api/search_template.js +27 -0
- package/api/api/shutdown.js +3 -0
- package/api/api/snapshot.js +210 -0
- package/api/api/tasks.js +56 -0
- package/api/api/terms_enum.js +1 -0
- package/api/api/termvectors.js +26 -0
- package/api/api/update.js +28 -0
- package/api/api/update_by_query.js +50 -0
- package/api/api/update_by_query_rethrottle.js +14 -0
- package/api/index.js +28 -0
- package/api/new.d.ts +64 -0
- package/api/opensearch_dashboards.d.ts +4 -0
- package/api/requestParams.d.ts +16 -0
- package/api/types.d.ts +47 -0
- package/index.d.ts +160 -0
- package/jenkins/release.JenkinsFile +2 -2
- package/lib/Serializer.js +1 -1
- package/lib/Transport.js +23 -1
- package/lib/aws/AwsSigv4Signer.js +14 -5
- package/package.json +10 -9
package/.eslintrc.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -3,22 +3,52 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
|
3
3
|
|
|
4
4
|
## [Unreleased]
|
|
5
5
|
### Added
|
|
6
|
-
-
|
|
7
|
-
-
|
|
6
|
+
- Add release details to releasing.md ([319](https://github.com/opensearch-project/opensearch-js/pull/319))
|
|
7
|
+
- Allow overriding the aws service identifier in AwsSigv4Signer ([333](https://github.com/opensearch-project/opensearch-js/pull/333))
|
|
8
|
+
- Added skip-changelog label ([339](https://github.com/opensearch-project/opensearch-js/pull/339))
|
|
9
|
+
- Added jsdoc for documentation generation ([#335](https://github.com/opensearch-project/opensearch-js/issues/335))
|
|
10
|
+
- Documented Transport#request ([#335](https://github.com/opensearch-project/opensearch-js/issues/335))
|
|
11
|
+
- Documented all API methods ([#335](https://github.com/opensearch-project/opensearch-js/issues/335))
|
|
12
|
+
- Added point in time APIs ([#348](https://github.com/opensearch-project/opensearch-js/pull/348))
|
|
13
|
+
- Added support for Amazon OpenSearch Serverless ([#356](https://github.com/opensearch-project/opensearch-js/issues/356))
|
|
14
|
+
|
|
8
15
|
### Dependencies
|
|
9
|
-
- Bumps `
|
|
10
|
-
- Bumps `
|
|
16
|
+
- Bumps `xmlbuilder2` from 2.4.1 to 3.0.2
|
|
17
|
+
- Bumps `minimatch` from 3.0.4 to 3.1.2
|
|
18
|
+
- Bumps `eslint` from 8.30.0 to 8.32.0
|
|
19
|
+
- Bumps `eslint` from 7.32.0 to 8.32.0
|
|
20
|
+
- Replaced `babel-eslint` with `@babel/eslint-parser`
|
|
21
|
+
- Bumps `eslint-plugin-prettier` from 4.0.0 to 4.2.1
|
|
22
|
+
- Bumps `minimist` from 1.2.6 to 1.2.7
|
|
23
|
+
- Bumps `@aws-sdk/types` from 3.190.0 to 3.226.0
|
|
24
|
+
- Bumps `json5` from 2.2.0 to 2.2.3
|
|
25
|
+
- Bumps `split2` from 3.2.2 to 4.1.0
|
|
26
|
+
- Bumps `@types/node` from 15.14.7 to 18.11.18
|
|
27
|
+
- Bumps `prettier` from 2.7.1 to 2.8.3
|
|
28
|
+
- Bumps `hpagent` from 0.1.2 to 1.2.0
|
|
29
|
+
- Bumps `eslint-config-prettier` from 8.5.0 to 8.6.0
|
|
30
|
+
- Bumps `rimraf` from 3.0.2 to 4.1.1
|
|
11
31
|
|
|
32
|
+
### Dependencies
|
|
12
33
|
### Changed
|
|
13
|
-
|
|
34
|
+
- Remove test artifacts from gh_pages workflow ([#335](https://github.com/opensearch-project/opensearch-js/issues/335))
|
|
14
35
|
### Deprecated
|
|
15
|
-
|
|
16
36
|
### Removed
|
|
17
|
-
|
|
18
37
|
### Fixed
|
|
19
|
-
- Fix mutability of connection headers ([#291](https://github.com/opensearch-project/opensearch-js/issues/291))
|
|
20
|
-
|
|
21
38
|
### Security
|
|
39
|
+
- [CVE-2022-25912] Bumps simple-git from 3.4.0 to 3.15.0 ([#341](https://github.com/opensearch-project/opensearch-js/pull/341))
|
|
22
40
|
|
|
41
|
+
## [2.1]
|
|
42
|
+
### Added
|
|
43
|
+
- Github workflow for changelog verification ([#306](https://github.com/opensearch-project/opensearch-js/pull/306))
|
|
44
|
+
- Add GitHub and Jenkins release workflow ([#317](https://github.com/opensearch-project/opensearch-js/pull/317))
|
|
45
|
+
|
|
46
|
+
### Dependencies
|
|
47
|
+
- Bumps `tsd` from 0.22.0 to 0.24.1
|
|
48
|
+
- Bumps `semver` from 7.3.7 to 7.3.8
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
- Fix mutability of connection headers ([#291](https://github.com/opensearch-project/opensearch-js/issues/291))
|
|
23
52
|
|
|
24
|
-
[
|
|
53
|
+
[2.1]: https://github.com/opensearch-project/opensearch-js/releases/tag/2.1.0
|
|
54
|
+
[Unreleased]: https://github.com/opensearch-project/opensearch-js/compare/2.1...HEAD
|
package/MAINTAINERS.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
## Overview
|
|
2
|
+
|
|
3
|
+
This document contains a list of maintainers in this repo. See [opensearch-project/.github/RESPONSIBILITIES.md](https://github.com/opensearch-project/.github/blob/main/RESPONSIBILITIES.md#maintainer-responsibilities) that explains what the role of maintainer means, what maintainers do in this and other repos, and how they should be doing it. If you're interested in contributing, and becoming a maintainer, see [CONTRIBUTING](CONTRIBUTING.md).
|
|
2
4
|
|
|
3
5
|
## Current Maintainers
|
|
4
6
|
|
|
5
7
|
| Maintainer | GitHub ID | Affiliation |
|
|
6
|
-
|
|
8
|
+
| --------------------- | --------------------------------------------- | ----------- |
|
|
7
9
|
| Anan Zhuang | [ananzh](https://github.com/ananzh) | Amazon |
|
|
8
10
|
| Bishoy Boktor | [boktorbb](https://github.com/boktorbb) | Amazon |
|
|
9
11
|
| Kawika (Rocky) Avilla | [kavilla](https://github.com/kavilla) | Amazon |
|
|
@@ -12,7 +14,3 @@
|
|
|
12
14
|
| Daniel Doubrovkine | [dblock](https://github.com/dblock) | Amazon |
|
|
13
15
|
| Vacha Shah | [VachaShah](https://github.com/VachaShah) | Amazon |
|
|
14
16
|
| Theo Truong | [nhtruong](https://github.com/nhtruong) | Amazon |
|
|
15
|
-
|
|
16
|
-
[This document](https://github.com/opensearch-project/.github/blob/main/MAINTAINERS.md)
|
|
17
|
-
explains what maintainers do in this repo, and how they should be doing it.
|
|
18
|
-
If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
|
package/RELEASING.md
CHANGED
|
@@ -31,4 +31,10 @@ Repositories create consistent release labels, such as `v1.0.0`, `v1.1.0` and `v
|
|
|
31
31
|
|
|
32
32
|
## Releasing
|
|
33
33
|
|
|
34
|
-
The release process is standard across repositories in this org and is run by a release manager volunteering from amongst [
|
|
34
|
+
The release process is standard across repositories in this org and is run by a release manager volunteering from amongst [maintainers](MAINTAINERS.md).
|
|
35
|
+
|
|
36
|
+
1. Create a tag, e.g. v2.1.0, and push it to the GitHub repo.
|
|
37
|
+
1. The [release-drafter.yml](.github/workflows/release-drafter.yml) will be automatically kicked off and a draft release will be created.
|
|
38
|
+
1. This draft release triggers the [jenkins release workflow](https://build.ci.opensearch.org/job/opensearch-js-release/) as a result of which opensearch-js client is released on [npmjs](https://www.npmjs.com/package/@opensearch-project/opensearch).
|
|
39
|
+
1. Once the above release workflow is successful, the drafted release on GitHub is published automatically.
|
|
40
|
+
1. Increment "version" in package.json to the next patch release, e.g. v2.1.1. See [example](https://github.com/opensearch-project/opensearch-js/pull/318)
|
package/USER_GUIDE.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
- [Delete the index](#delete-the-index)
|
|
13
13
|
|
|
14
14
|
## Initializing a Client
|
|
15
|
+
|
|
15
16
|
```javascript
|
|
16
17
|
'use strict';
|
|
17
18
|
|
|
@@ -70,14 +71,14 @@ const client = new Client({
|
|
|
70
71
|
});
|
|
71
72
|
}),
|
|
72
73
|
}),
|
|
73
|
-
node:
|
|
74
|
+
node: 'https://search-xxx.region.es.amazonaws.com', // OpenSearch domain URL
|
|
74
75
|
});
|
|
75
76
|
```
|
|
76
77
|
|
|
77
78
|
#### Using AWS V3 SDK
|
|
78
79
|
|
|
79
80
|
```javascript
|
|
80
|
-
const { defaultProvider } = require(
|
|
81
|
+
const { defaultProvider } = require('@aws-sdk/credential-provider-node'); // V3 SDK.
|
|
81
82
|
const { Client } = require('@opensearch-project/opensearch');
|
|
82
83
|
const { AwsSigv4Signer } = require('@opensearch-project/opensearch/aws');
|
|
83
84
|
|
|
@@ -97,101 +98,151 @@ const client = new Client({
|
|
|
97
98
|
return credentialsProvider();
|
|
98
99
|
},
|
|
99
100
|
}),
|
|
100
|
-
node:
|
|
101
|
+
node: 'https://search-xxx.region.es.amazonaws.com', // OpenSearch domain URL
|
|
101
102
|
});
|
|
102
103
|
```
|
|
103
104
|
|
|
104
105
|
## Create an Index
|
|
105
106
|
|
|
106
107
|
```javascript
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
108
|
+
console.log('Creating index:');
|
|
109
|
+
|
|
110
|
+
var index_name = 'books';
|
|
111
|
+
var settings = {
|
|
112
|
+
settings: {
|
|
113
|
+
index: {
|
|
114
|
+
number_of_shards: 4,
|
|
115
|
+
number_of_replicas: 3,
|
|
116
116
|
},
|
|
117
|
-
}
|
|
117
|
+
},
|
|
118
|
+
};
|
|
118
119
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
var response = await client.indices.create({
|
|
121
|
+
index: index_name,
|
|
122
|
+
body: settings,
|
|
123
|
+
});
|
|
123
124
|
|
|
124
|
-
|
|
125
|
+
console.log(response.body);
|
|
125
126
|
```
|
|
126
127
|
|
|
127
128
|
## Add a Document to the Index
|
|
128
129
|
|
|
129
130
|
```javascript
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
131
|
+
console.log('Adding document:');
|
|
132
|
+
|
|
133
|
+
var document = {
|
|
134
|
+
title: 'The Outsider',
|
|
135
|
+
author: 'Stephen King',
|
|
136
|
+
year: '2018',
|
|
137
|
+
genre: 'Crime fiction',
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
var id = '1';
|
|
141
|
+
|
|
142
|
+
var response = await client.index({
|
|
143
|
+
id: id,
|
|
144
|
+
index: index_name,
|
|
145
|
+
body: document,
|
|
146
|
+
refresh: true,
|
|
147
|
+
});
|
|
147
148
|
|
|
148
|
-
|
|
149
|
+
console.log(response.body);
|
|
149
150
|
```
|
|
150
151
|
|
|
151
152
|
## Search for the Document
|
|
152
153
|
|
|
153
154
|
```javascript
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
},
|
|
155
|
+
console.log('Search results:');
|
|
156
|
+
|
|
157
|
+
var query = {
|
|
158
|
+
query: {
|
|
159
|
+
match: {
|
|
160
|
+
title: {
|
|
161
|
+
query: 'The Outsider',
|
|
162
162
|
},
|
|
163
163
|
},
|
|
164
|
-
}
|
|
164
|
+
},
|
|
165
|
+
};
|
|
165
166
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
var response = await client.search({
|
|
168
|
+
index: index_name,
|
|
169
|
+
body: query,
|
|
170
|
+
});
|
|
170
171
|
|
|
171
|
-
|
|
172
|
+
console.log(response.body.hits);
|
|
172
173
|
```
|
|
173
174
|
|
|
174
175
|
## Delete the document
|
|
175
176
|
|
|
176
177
|
```javascript
|
|
177
|
-
|
|
178
|
+
console.log('Deleting document:');
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
var response = await client.delete({
|
|
181
|
+
index: index_name,
|
|
182
|
+
id: id,
|
|
183
|
+
});
|
|
183
184
|
|
|
184
|
-
|
|
185
|
+
console.log(response.body);
|
|
185
186
|
```
|
|
186
187
|
|
|
187
188
|
## Delete the index
|
|
188
189
|
|
|
189
190
|
```javascript
|
|
190
|
-
|
|
191
|
+
console.log('Deleting index:');
|
|
192
|
+
|
|
193
|
+
var response = await client.indices.delete({
|
|
194
|
+
index: index_name,
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
console.log(response.body);
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Create a Point in Time
|
|
201
|
+
|
|
202
|
+
```javascript
|
|
203
|
+
console.log('Creating a PIT:');
|
|
204
|
+
|
|
205
|
+
var response = await client.createPit({
|
|
206
|
+
index: 'books*',
|
|
207
|
+
keep_alive: '100m',
|
|
208
|
+
expand_wildcards: 'all',
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
console.log(response.body);
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Get all PITs
|
|
215
|
+
|
|
216
|
+
```javascript
|
|
217
|
+
console.log('Getting all PITs:');
|
|
218
|
+
|
|
219
|
+
var response = await client.getAllPits();
|
|
220
|
+
|
|
221
|
+
console.log(response.body);
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Delete a Point in Time
|
|
225
|
+
|
|
226
|
+
```javascript
|
|
227
|
+
console.log('Deleting a PIT:');
|
|
228
|
+
|
|
229
|
+
var response = await client.deletePit({
|
|
230
|
+
body: {
|
|
231
|
+
pit_id: [
|
|
232
|
+
'o463QQEPbXktaW5kZXgtMDAwMDAxFkhGN09fMVlPUkVPLXh6MUExZ1hpaEEAFjBGbmVEZHdGU1EtaFhhUFc4ZkR5cWcAAAAAAAAAAAEWaXBPNVJtZEhTZDZXTWFFR05waXdWZwEWSEY3T18xWU9SRU8teHoxQTFnWGloQQAA',
|
|
233
|
+
],
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
console.log(response.body);
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Delete all PITs
|
|
241
|
+
|
|
242
|
+
```javascript
|
|
243
|
+
console.log('Deleting all PITs:');
|
|
191
244
|
|
|
192
|
-
|
|
193
|
-
index: index_name,
|
|
194
|
-
});
|
|
245
|
+
var response = await client.deleteAllPits();
|
|
195
246
|
|
|
196
|
-
|
|
247
|
+
console.log(response.body);
|
|
197
248
|
```
|
package/api/api/bulk.js
CHANGED
|
@@ -63,6 +63,29 @@ const snakeCase = {
|
|
|
63
63
|
filterPath: 'filter_path',
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* The bulk operation lets you add, update, or delete many documents in a single request.
|
|
68
|
+
* Compared to individual OpenSearch indexing requests, the bulk operation has significant performance benefits.
|
|
69
|
+
* Whenever practical, we recommend batching indexing operations into bulk requests.
|
|
70
|
+
* <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/document-apis/bulk/|OpenSearch - Bulk}
|
|
71
|
+
*
|
|
72
|
+
* @memberOf API-Document
|
|
73
|
+
*
|
|
74
|
+
* @param {Object} params
|
|
75
|
+
* @param {Object[]} params.body - {@link https://opensearch.org/docs/latest/api-reference/document-apis/bulk/#request-body|Request Body}
|
|
76
|
+
* @param {string} [params.index] - Specifying the index means you don’t need to include it in the request body.
|
|
77
|
+
* @param {string} [params.pipeline] - The pipeline ID for preprocessing documents.
|
|
78
|
+
* @param {string} [params.routing] - Routes the request to the specified shard.
|
|
79
|
+
* @param {string} [params.refresh=false] - If true, OpenSearch refreshes shards to make the operation visible to searching. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation.
|
|
80
|
+
* @param {string} [params.timeout=1m] - How long to wait for a response from the cluster.
|
|
81
|
+
* @param {string} [params.wait_for_active_shards] - The number of active shards that must be available before OpenSearch processes the request. Default is 1 (only the primary shard). Set to all or a positive integer. Values greater than 1 require replicas. For example, if you specify a value of 3, the index must have two replicas distributed across two additional nodes for the operation to succeed.
|
|
82
|
+
* @param {boolean} [params.require_alias=false] - Specifies whether the target index must be an index alias.
|
|
83
|
+
*
|
|
84
|
+
* @param {Object} options - Options for {@link Transport#request}
|
|
85
|
+
* @param {function} callback - Callback that handles errors and response
|
|
86
|
+
*
|
|
87
|
+
* @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*} {@link https://opensearch.org/docs/latest/api-reference/document-apis/bulk/#response|Bulk Response}
|
|
88
|
+
*/
|
|
66
89
|
function bulkApi(params, options, callback) {
|
|
67
90
|
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
68
91
|
|