@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.
- package/.eslintignore +2 -0
- package/.eslintrc.json +26 -0
- package/.prettierrc.json +5 -0
- package/.whitesource +15 -0
- package/ADMINS.md +18 -11
- package/COMPATIBILITY.md +24 -0
- package/DEVELOPER_GUIDE.md +22 -5
- package/MAINTAINERS.md +23 -18
- package/README.md +102 -106
- package/RELEASING.md +3 -3
- package/SECURITY.md +1 -1
- package/api/api/bulk.js +53 -26
- package/api/api/cat.js +354 -264
- package/api/api/clear_scroll.js +17 -17
- package/api/api/cluster.js +366 -219
- package/api/api/count.js +55 -24
- package/api/api/create.js +50 -24
- package/api/api/dangling_indices.js +95 -51
- package/api/api/delete.js +49 -22
- package/api/api/delete_by_query.js +88 -25
- package/api/api/delete_by_query_rethrottle.js +33 -19
- package/api/api/delete_script.js +31 -17
- package/api/api/exists.js +55 -22
- package/api/api/exists_source.js +60 -27
- package/api/api/explain.js +60 -22
- package/api/api/features.js +56 -35
- package/api/api/field_caps.js +36 -18
- package/api/api/get.js +55 -22
- package/api/api/get_script.js +30 -17
- package/api/api/get_script_context.js +15 -15
- package/api/api/get_script_languages.js +15 -15
- package/api/api/get_source.js +55 -22
- package/api/api/index.js +60 -28
- package/api/api/indices.js +1068 -857
- package/api/api/info.js +15 -15
- package/api/api/ingest.js +132 -96
- package/api/api/mget.js +50 -26
- package/api/api/msearch.js +49 -26
- package/api/api/msearch_template.js +53 -26
- package/api/api/mtermvectors.js +48 -24
- package/api/api/nodes.js +281 -154
- package/api/api/ping.js +15 -15
- package/api/api/put_script.js +40 -25
- package/api/api/rank_eval.js +37 -20
- package/api/api/reindex.js +38 -17
- package/api/api/reindex_rethrottle.js +32 -19
- package/api/api/render_search_template.js +18 -18
- package/api/api/scripts_painless_execute.js +15 -15
- package/api/api/scroll.js +31 -17
- package/api/api/search.js +108 -24
- package/api/api/search_shards.js +36 -18
- package/api/api/search_template.js +64 -26
- package/api/api/shutdown.js +66 -54
- package/api/api/snapshot.js +347 -224
- package/api/api/tasks.js +65 -46
- package/api/api/terms_enum.js +17 -17
- package/api/api/termvectors.js +57 -26
- package/api/api/update.js +64 -24
- package/api/api/update_by_query.js +89 -23
- package/api/api/update_by_query_rethrottle.js +33 -19
- package/api/index.js +267 -179
- package/api/new.d.ts +2042 -529
- package/api/opensearch_dashboards.d.ts +275 -0
- package/api/requestParams.d.ts +301 -69
- package/api/types.d.ts +6204 -5719
- package/api/utils.js +22 -22
- package/codecov.yml +2 -2
- package/index.d.ts +4779 -934
- package/index.js +153 -140
- package/index.mjs +9 -9
- package/lib/Connection.d.ts +37 -26
- package/lib/Connection.js +163 -168
- package/lib/Helpers.d.ts +103 -63
- package/lib/Helpers.js +398 -371
- package/lib/Serializer.d.ts +2 -2
- package/lib/Serializer.js +39 -39
- package/lib/Transport.d.ts +30 -12
- package/lib/Transport.js +383 -324
- package/lib/errors.d.ts +25 -7
- package/lib/errors.js +75 -71
- package/lib/pool/BaseConnectionPool.js +100 -97
- package/lib/pool/CloudConnectionPool.js +16 -16
- package/lib/pool/ConnectionPool.js +105 -105
- package/lib/pool/index.d.ts +8 -6
- package/lib/pool/index.js +6 -6
- package/package.json +13 -8
package/.eslintignore
ADDED
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"node": true,
|
|
4
|
+
"es6": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"prettier"
|
|
9
|
+
],
|
|
10
|
+
"parser": "babel-eslint",
|
|
11
|
+
"plugins": [
|
|
12
|
+
"prettier"
|
|
13
|
+
],
|
|
14
|
+
"rules": {
|
|
15
|
+
"prettier/prettier": [
|
|
16
|
+
"error",
|
|
17
|
+
{
|
|
18
|
+
"endOfLine": "auto"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
/*temporarily turn off no-unused-vars, open an issue to track https://github.com/opensearch-project/opensearch-js/issues/241*/
|
|
22
|
+
"no-unused-vars": "off",
|
|
23
|
+
/*temporarily turn off no-dupe-else-if, open an issue to track https://github.com/opensearch-project/opensearch-js/issues/240*/
|
|
24
|
+
"no-dupe-else-if": "off"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/.prettierrc.json
ADDED
package/.whitesource
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scanSettings": {
|
|
3
|
+
"configMode": "AUTO",
|
|
4
|
+
"configExternalURL": "",
|
|
5
|
+
"projectToken": "",
|
|
6
|
+
"baseBranches": []
|
|
7
|
+
},
|
|
8
|
+
"checkRunSettings": {
|
|
9
|
+
"vulnerableCheckRunConclusionLevel": "failure",
|
|
10
|
+
"displayMode": "diff"
|
|
11
|
+
},
|
|
12
|
+
"issueSettings": {
|
|
13
|
+
"minSeverityLevel": "LOW"
|
|
14
|
+
}
|
|
15
|
+
}
|
package/ADMINS.md
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
|
+
- [Overview](#overview)
|
|
2
|
+
- [Current Admins](#current-admins)
|
|
3
|
+
- [Admin Responsibilities](#admin-responsibilities)
|
|
4
|
+
- [Prioritize Security](#prioritize-security)
|
|
5
|
+
- [Enforce Code of Conduct](#enforce-code-of-conduct)
|
|
6
|
+
- [Adopt Organizational Best Practices](#adopt-organizational-best-practices)
|
|
7
|
+
|
|
1
8
|
## Overview
|
|
2
9
|
|
|
3
10
|
This document explains who the admins are (see below), what they do in this repo, and how they should be doing it. If you're interested in becoming a maintainer, see [MAINTAINERS](MAINTAINERS.md). If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
|
|
4
11
|
|
|
5
12
|
## Current Admins
|
|
6
13
|
|
|
7
|
-
| Admin
|
|
8
|
-
|
|
|
9
|
-
| Anan Zhuang
|
|
10
|
-
| Bishoy Boktor
|
|
11
|
-
| Charlotte
|
|
12
|
-
| Henri Yandell
|
|
13
|
-
| Kawika (Rocky) Avilla
|
|
14
|
-
| Mihir Soni
|
|
15
|
-
| Sean Neumann
|
|
16
|
-
| Tommy Markley
|
|
14
|
+
| Admin | GitHub ID | Affiliation |
|
|
15
|
+
| --------------------- | ------------------------------------------------- | ----------- |
|
|
16
|
+
| Anan Zhuang | [ananzh](https://github.com/ananzh) | Amazon |
|
|
17
|
+
| Bishoy Boktor | [boktorbb-amzn](https://github.com/boktorbb-amzn) | Amazon |
|
|
18
|
+
| Charlotte | [CEHENKLE](https://github.com/CEHENKLE) | Amazon |
|
|
19
|
+
| Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon |
|
|
20
|
+
| Kawika (Rocky) Avilla | [kavilla](https://github.com/kavilla) | Amazon |
|
|
21
|
+
| Mihir Soni | [mihirsoni](https://github.com/mihirsoni) | Amazon |
|
|
22
|
+
| Sean Neumann | [seanneumann](https://github.com/seanneumann) | Amazon |
|
|
23
|
+
| Tommy Markley | [tmarkley](https://github.com/tmarkley) | Amazon |
|
|
17
24
|
|
|
18
25
|
## Admin Responsibilities
|
|
19
26
|
|
|
@@ -31,4 +38,4 @@ Act on [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) violations by revoking access, and
|
|
|
31
38
|
|
|
32
39
|
### Adopt Organizational Best Practices
|
|
33
40
|
|
|
34
|
-
Adopt organizational best practices, work in the open, and collaborate with other admins by opening issues before making process changes. Prefer consistency, and avoid diverging from practices in the opensearch-project organization.
|
|
41
|
+
Adopt organizational best practices, work in the open, and collaborate with other admins by opening issues before making process changes. Prefer consistency, and avoid diverging from practices in the opensearch-project organization.
|
package/COMPATIBILITY.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
- [Compatibility with OpenSearch](#compatibility-with-opensearch)
|
|
2
|
+
- [Upgrading](#upgrading)
|
|
3
|
+
|
|
4
|
+
## Compatibility with OpenSearch
|
|
5
|
+
|
|
6
|
+
The below matrix shows the compatibility of the [`opensearch-js`](https://www.npmjs.com/package/@opensearch-project/opensearch) with versions of [`OpenSearch`](https://opensearch.org/downloads.html#opensearch).
|
|
7
|
+
|
|
8
|
+
| OpenSearch Version | Client Version |
|
|
9
|
+
| ------------------ | -------------- |
|
|
10
|
+
| 1.0.0 | 1.0.0 |
|
|
11
|
+
| 1.0.1 | 1.0.0 |
|
|
12
|
+
| 1.1.0 | 1.1.0 |
|
|
13
|
+
| 1.2.0 | 1.1.0 |
|
|
14
|
+
| 1.2.1 | 1.1.0 |
|
|
15
|
+
| 1.2.2 | 1.1.0 |
|
|
16
|
+
| 1.2.3 | 1.1.0 |
|
|
17
|
+
| 1.2.4 | 1.1.0 |
|
|
18
|
+
| 1.3.0 | 1.1.0 |
|
|
19
|
+
| 1.3.1 | 1.1.0 |
|
|
20
|
+
| 2.0.0 | 2.0.0 |
|
|
21
|
+
|
|
22
|
+
## Upgrading
|
|
23
|
+
|
|
24
|
+
Major versions of OpenSearch introduce breaking changes that require careful upgrades of the client. While `opensearch-js` 2.0.0 works against OpenSearch 1.3.1, certain deprecated features removed in OpenSearch 2.0 have also been removed from the client. Please refer to the [OpenSearch documentation](https://opensearch.org/docs/latest/clients/index/) for more information.
|
package/DEVELOPER_GUIDE.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
- [Developer Guide](#developer-guide)
|
|
2
|
+
- [Getting Started](#getting-started)
|
|
3
|
+
- [Git Clone OpenSearch Node.js Client Repository](#git-clone-opensearch-nodejs-client-repository)
|
|
4
|
+
- [Install Prerequisites](#install-prerequisites)
|
|
5
|
+
- [Node.js](#nodejs)
|
|
6
|
+
- [Docker](#docker)
|
|
7
|
+
- [Unit Testing](#unit-testing)
|
|
8
|
+
- [Integration Testing](#integration-testing)
|
|
9
|
+
- [Execute integration tests from your terminal](#execute-integration-tests-from-your-terminal)
|
|
10
|
+
|
|
1
11
|
# Developer Guide
|
|
2
12
|
|
|
3
|
-
So you want to contribute code to the OpenSearch Node.js Client?
|
|
13
|
+
So you want to contribute code to the OpenSearch Node.js Client? Excellent! We're glad you're here. Here's what you need to do:
|
|
4
14
|
|
|
5
15
|
## Getting Started
|
|
6
16
|
|
|
@@ -11,7 +21,8 @@ e.g. `git clone https://github.com/[your username]/opensearch-js.git`.
|
|
|
11
21
|
|
|
12
22
|
### Install Prerequisites
|
|
13
23
|
|
|
14
|
-
#### Node.js
|
|
24
|
+
#### Node.js
|
|
25
|
+
|
|
15
26
|
The minimum supported version of Node.js is v10.
|
|
16
27
|
|
|
17
28
|
#### Docker
|
|
@@ -19,32 +30,38 @@ The minimum supported version of Node.js is v10.
|
|
|
19
30
|
[Docker](https://docs.docker.com/install/) is required for building some OpenSearch artifacts and executing integration tests.
|
|
20
31
|
|
|
21
32
|
### Unit Testing
|
|
33
|
+
|
|
22
34
|
Go to your terminal and run:
|
|
35
|
+
|
|
23
36
|
```
|
|
24
37
|
cd folder-path
|
|
25
38
|
npm run test:unit
|
|
26
39
|
```
|
|
27
|
-
|
|
40
|
+
|
|
28
41
|
To run a specific unit test, you can use the following jest command. `npm test` will not work.
|
|
42
|
+
|
|
29
43
|
```
|
|
30
44
|
cd folder-path/to/test
|
|
31
45
|
jest TestName
|
|
32
46
|
```
|
|
33
47
|
|
|
34
48
|
If you don't have jest, you can install it via npm or yarn
|
|
49
|
+
|
|
35
50
|
```
|
|
36
51
|
npm i -g jest-cli
|
|
37
52
|
yarn global add jest-cli
|
|
38
53
|
```
|
|
39
54
|
|
|
40
55
|
### Integration Testing
|
|
41
|
-
|
|
56
|
+
|
|
57
|
+
In order to test opensearch-js client, you need a running OpenSearch cluster. You can use Docker to accomplish this.
|
|
42
58
|
The [Docker Compose file](.ci/opensearch/docker-compose.yml) supports the ability to run integration tests for the project in local environments.
|
|
43
59
|
If you have not installed docker-compose, you can install it from this [link](https://docs.docker.com/compose/install/).
|
|
44
60
|
|
|
45
61
|
#### Execute integration tests from your terminal
|
|
46
62
|
|
|
47
63
|
1. Run below command to start containers. By default, it will launch latest OpenSearch cluster.
|
|
64
|
+
|
|
48
65
|
```
|
|
49
66
|
cd folder-path/.ci/opensearch
|
|
50
67
|
docker-compose up
|
|
@@ -54,7 +71,7 @@ If you have not installed docker-compose, you can install it from this [link](ht
|
|
|
54
71
|
```
|
|
55
72
|
npm run test:integration:helpers
|
|
56
73
|
```
|
|
57
|
-
|
|
74
|
+
3. Stop and clean containers.
|
|
58
75
|
```
|
|
59
76
|
docker-compose down
|
|
60
77
|
```
|
package/MAINTAINERS.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
- [Overview](#overview)
|
|
2
2
|
- [Current Maintainers](#current-maintainers)
|
|
3
3
|
- [Maintainer Responsibilities](#maintainer-responsibilities)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
- [Uphold Code of Conduct](#uphold-code-of-conduct)
|
|
5
|
+
- [Prioritize Security](#prioritize-security)
|
|
6
|
+
- [Review Pull Requests](#review-pull-requests)
|
|
7
|
+
- [Triage Open Issues](#triage-open-issues)
|
|
8
|
+
- [Backports](#backports)
|
|
9
|
+
- [Be Responsive](#be-responsive)
|
|
10
|
+
- [Maintain Overall Health of the Repo](#maintain-overall-health-of-the-repo)
|
|
11
|
+
- [Use Semver](#use-semver)
|
|
12
|
+
- [Release Frequently](#release-frequently)
|
|
13
|
+
- [Promote Other Maintainers](#promote-other-maintainers)
|
|
13
14
|
|
|
14
15
|
## Overview
|
|
15
16
|
|
|
@@ -17,14 +18,14 @@ This document explains who the maintainers are (see below), what they do in this
|
|
|
17
18
|
|
|
18
19
|
## Current Maintainers
|
|
19
20
|
|
|
20
|
-
| Maintainer
|
|
21
|
-
|
|
|
22
|
-
| Anan Zhuang
|
|
23
|
-
| Bishoy Boktor
|
|
24
|
-
| Kawika (Rocky) Avilla
|
|
25
|
-
| Mihir Soni
|
|
26
|
-
| Sean Neumann
|
|
27
|
-
| Tommy Markley
|
|
21
|
+
| Maintainer | GitHub ID | Affiliation |
|
|
22
|
+
| --------------------- | ------------------------------------------------- | ----------- |
|
|
23
|
+
| Anan Zhuang | [ananzh](https://github.com/ananzh) | Amazon |
|
|
24
|
+
| Bishoy Boktor | [boktorbb-amzn](https://github.com/boktorbb-amzn) | Amazon |
|
|
25
|
+
| Kawika (Rocky) Avilla | [kavilla](https://github.com/kavilla) | Amazon |
|
|
26
|
+
| Mihir Soni | [mihirsoni](https://github.com/mihirsoni) | Amazon |
|
|
27
|
+
| Sean Neumann | [seanneumann](https://github.com/seanneumann) | Amazon |
|
|
28
|
+
| Tommy Markley | [tmarkley](https://github.com/tmarkley) | Amazon |
|
|
28
29
|
|
|
29
30
|
## Maintainer Responsibilities
|
|
30
31
|
|
|
@@ -52,6 +53,10 @@ All repositories in this organization have a standard set of labels, including `
|
|
|
52
53
|
|
|
53
54
|
Use labels to target an issue or a PR for a given release, add `help wanted` to good issues for new community members, and `blocker` for issues that scare you or need immediate attention. Request for more information from a submitter if an issue is not clear. Create new labels as needed by the project.
|
|
54
55
|
|
|
56
|
+
### Backports
|
|
57
|
+
|
|
58
|
+
The Github workflow in [backport.yml](.github/workflows/backport.yml) creates backport PRs automatically when the original PR with an appropriate label `backport <backport-branch-name>` is merged to main. To backport a PR to `1.x`, add a label `backport 1.x` to the PR, once this PR is merged to main, the workflow will create a backport PR to the `1.x` branch.
|
|
59
|
+
|
|
55
60
|
### Be Responsive
|
|
56
61
|
|
|
57
62
|
Respond to enhancement requests, and forum posts. Allocate time to reviewing and commenting on issues and conversations as they come in.
|
|
@@ -70,4 +75,4 @@ Make frequent project releases to the community.
|
|
|
70
75
|
|
|
71
76
|
### Promote Other Maintainers
|
|
72
77
|
|
|
73
|
-
Assist, add, and remove [MAINTAINERS](MAINTAINERS.md). Exercise good judgement, and propose high quality contributors to become co-maintainers.
|
|
78
|
+
Assist, add, and remove [MAINTAINERS](MAINTAINERS.md). Exercise good judgement, and propose high quality contributors to become co-maintainers.
|
package/README.md
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
OpenSearch Node.js client
|
|
11
11
|
|
|
12
12
|
- [Welcome!](#welcome)
|
|
13
|
+
- [Example use](#example-use)
|
|
14
|
+
- [Setup](#setup)
|
|
15
|
+
- [Sample code](#sample-code)
|
|
13
16
|
- [Project Resources](#project-resources)
|
|
14
17
|
- [Code of Conduct](#code-of-conduct)
|
|
15
18
|
- [License](#license)
|
|
@@ -17,35 +20,30 @@ OpenSearch Node.js client
|
|
|
17
20
|
|
|
18
21
|
## Welcome!
|
|
19
22
|
|
|
20
|
-
**opensearch-js** is [a community-driven, open source fork](https://aws.amazon.com/blogs/opensource/introducing-opensearch/) of elasticsearch-js licensed under the [Apache v2.0 License](LICENSE.txt). For more information, see [opensearch.org](https://opensearch.org/).
|
|
23
|
+
**[opensearch-js](https://www.npmjs.com/package/@opensearch-project/opensearch)** is [a community-driven, open source fork](https://aws.amazon.com/blogs/opensource/introducing-opensearch/) of elasticsearch-js licensed under the [Apache v2.0 License](LICENSE.txt). For more information, see [opensearch.org](https://opensearch.org/).
|
|
21
24
|
|
|
22
25
|
## Example use
|
|
26
|
+
|
|
23
27
|
The OpenSearch JavaScript client provides a safer and easier way to interact with your OpenSearch cluster. Rather than using OpenSearch from the browser and potentially exposing your data to the public, you can build an OpenSearch client that takes care of sending requests to your cluster.
|
|
24
28
|
|
|
25
29
|
The client contains a library of APIs that let you perform different operations on your cluster and return a standard response body. The example here demonstrates some basic operations like creating an index, adding documents, and searching your data.
|
|
26
30
|
|
|
27
|
-
|
|
28
31
|
### Setup
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
To add the client to your project, install it with npm:
|
|
31
34
|
|
|
32
35
|
```bash
|
|
33
|
-
npm
|
|
36
|
+
npm i @opensearch-project/opensearch
|
|
34
37
|
```
|
|
35
38
|
|
|
36
|
-
_Note: this module will be added to the NPM registry in the coming weeks._
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
39
|
If you prefer to add the client manually or just want to examine the source code, see [opensearch-js](https://github.com/opensearch-project/opensearch-js) on GitHub.
|
|
41
40
|
|
|
42
41
|
Then require the client:
|
|
43
42
|
|
|
44
43
|
```javascript
|
|
45
|
-
const { Client } = require('@opensearch-project/opensearch')
|
|
44
|
+
const { Client } = require('@opensearch-project/opensearch');
|
|
46
45
|
```
|
|
47
46
|
|
|
48
|
-
|
|
49
47
|
### Sample code
|
|
50
48
|
|
|
51
49
|
```javascript
|
|
@@ -65,115 +63,113 @@ var ca_certs_path = '/full/path/to/root-ca.pem';
|
|
|
65
63
|
var { Client } = require('@opensearch-project/opensearch');
|
|
66
64
|
var fs = require('fs');
|
|
67
65
|
var client = new Client({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
})
|
|
66
|
+
node: protocol + '://' + auth + '@' + host + ':' + port,
|
|
67
|
+
ssl: {
|
|
68
|
+
ca: fs.readFileSync(ca_certs_path),
|
|
69
|
+
// You can turn off certificate verification (rejectUnauthorized: false) if you're using self-signed certificates with a hostname mismatch.
|
|
70
|
+
// cert: fs.readFileSync(client_cert_path),
|
|
71
|
+
// key: fs.readFileSync(client_key_path)
|
|
72
|
+
},
|
|
73
|
+
});
|
|
76
74
|
|
|
77
75
|
async function search() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
console.log(response.body)
|
|
76
|
+
// Create an index with non-default settings.
|
|
77
|
+
var index_name = 'books';
|
|
78
|
+
var settings = {
|
|
79
|
+
settings: {
|
|
80
|
+
index: {
|
|
81
|
+
number_of_shards: 4,
|
|
82
|
+
number_of_replicas: 3,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
var response = await client.indices.create({
|
|
88
|
+
index: index_name,
|
|
89
|
+
body: settings,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
console.log('Creating index:');
|
|
93
|
+
console.log(response.body);
|
|
94
|
+
|
|
95
|
+
// Add a document to the index.
|
|
96
|
+
var document = {
|
|
97
|
+
title: 'The Outsider',
|
|
98
|
+
author: 'Stephen King',
|
|
99
|
+
year: '2018',
|
|
100
|
+
genre: 'Crime fiction',
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
var id = '1';
|
|
104
|
+
|
|
105
|
+
var response = await client.index({
|
|
106
|
+
id: id,
|
|
107
|
+
index: index_name,
|
|
108
|
+
body: document,
|
|
109
|
+
refresh: true,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
console.log('Adding document:');
|
|
113
|
+
console.log(response.body);
|
|
114
|
+
|
|
115
|
+
// Search for the document.
|
|
116
|
+
var query = {
|
|
117
|
+
query: {
|
|
118
|
+
match: {
|
|
119
|
+
title: {
|
|
120
|
+
query: 'The Outsider',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var response = await client.search({
|
|
127
|
+
index: index_name,
|
|
128
|
+
body: query,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
console.log('Search results:');
|
|
132
|
+
console.log(response.body.hits);
|
|
133
|
+
|
|
134
|
+
// Delete the document.
|
|
135
|
+
var response = await client.delete({
|
|
136
|
+
index: index_name,
|
|
137
|
+
id: id,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
console.log('Deleting document:');
|
|
141
|
+
console.log(response.body);
|
|
142
|
+
|
|
143
|
+
// Delete the index.
|
|
144
|
+
var response = await client.indices.delete({
|
|
145
|
+
index: index_name,
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
console.log('Deleting index:');
|
|
149
|
+
console.log(response.body);
|
|
153
150
|
}
|
|
154
151
|
|
|
155
|
-
search().catch(console.log)
|
|
152
|
+
search().catch(console.log);
|
|
156
153
|
```
|
|
157
154
|
|
|
158
155
|
## Project Resources
|
|
159
156
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
157
|
+
- [Project Website](https://opensearch.org/)
|
|
158
|
+
- [Downloads](https://opensearch.org/downloads.html).
|
|
159
|
+
- [Documentation](https://opensearch.org/docs/)
|
|
160
|
+
- Need help? Try [Forums](https://discuss.opendistrocommunity.dev/)
|
|
161
|
+
- [Project Principles](https://opensearch.org/#principles)
|
|
162
|
+
- [Contributing to OpenSearch](CONTRIBUTING.md)
|
|
163
|
+
- [Maintainer Responsibilities](MAINTAINERS.md)
|
|
164
|
+
- [Release Management](RELEASING.md)
|
|
165
|
+
- [Admin Responsibilities](ADMINS.md)
|
|
166
|
+
- [Security](SECURITY.md)
|
|
167
|
+
- [NPM Page](https://www.npmjs.com/package/@opensearch-project/opensearch)
|
|
171
168
|
|
|
172
169
|
## Code of Conduct
|
|
173
170
|
|
|
174
171
|
This project has adopted the [Amazon Open Source Code of Conduct](CODE_OF_CONDUCT.md). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq), or contact [opensource-codeofconduct@amazon.com](mailto:opensource-codeofconduct@amazon.com) with any additional questions or comments.
|
|
175
172
|
|
|
176
|
-
|
|
177
173
|
## License
|
|
178
174
|
|
|
179
175
|
This project is licensed under the [Apache v2.0 License](LICENSE.txt).
|
package/RELEASING.md
CHANGED
|
@@ -15,9 +15,9 @@ This document explains the release strategy for artifacts in this organization.
|
|
|
15
15
|
|
|
16
16
|
Given the current major release of 1.0, projects in this organization maintain the following active branches.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
- **main**: The next _major_ release. This is the branch where all merges take place and code moves fast.
|
|
19
|
+
- **1.x**: The next _minor_ release. Once a change is merged into `main`, decide whether to backport it to `1.x`.
|
|
20
|
+
- **1.0**: The _current_ release. In between minor releases, only hotfixes (e.g. security) are backported to `1.0`.
|
|
21
21
|
|
|
22
22
|
Label PRs with the next major version label (e.g. `2.0.0`) and merge changes into `main`. Label PRs that you believe need to be backported as `1.x` and `1.0`. Backport PRs by checking out the versioned branch, cherry-pick changes and open a PR against each target backport branch.
|
|
23
23
|
|
package/SECURITY.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
## Reporting a Vulnerability
|
|
2
2
|
|
|
3
|
-
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/) or directly via email to aws-security@amazon.com. Please do **not** create a public GitHub issue.
|
|
3
|
+
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/) or directly via email to aws-security@amazon.com. Please do **not** create a public GitHub issue.
|