@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.
- package/.eslintignore +2 -0
- package/.eslintrc.json +31 -0
- package/.prettierrc.json +5 -0
- package/.whitesource +15 -0
- package/ADMINS.md +13 -31
- package/CHANGELOG.md +24 -0
- package/COMPATIBILITY.md +27 -0
- package/DEVELOPER_GUIDE.md +22 -5
- package/MAINTAINERS.md +15 -70
- package/Makefile +2 -12
- package/README.md +19 -123
- package/RELEASING.md +3 -3
- package/SECURITY.md +1 -1
- package/USER_GUIDE.md +197 -0
- package/api/api/bulk.js +54 -28
- package/api/api/cat.js +355 -266
- package/api/api/clear_scroll.js +18 -19
- package/api/api/cluster.js +367 -221
- package/api/api/count.js +56 -26
- package/api/api/create.js +51 -26
- package/api/api/dangling_indices.js +96 -53
- package/api/api/delete.js +50 -24
- package/api/api/delete_by_query.js +89 -27
- package/api/api/delete_by_query_rethrottle.js +34 -21
- package/api/api/delete_script.js +32 -19
- package/api/api/exists.js +56 -24
- package/api/api/exists_source.js +61 -29
- package/api/api/explain.js +61 -24
- package/api/api/features.js +57 -37
- package/api/api/field_caps.js +37 -20
- package/api/api/get.js +56 -24
- package/api/api/get_script.js +31 -19
- package/api/api/get_script_context.js +16 -17
- package/api/api/get_script_languages.js +16 -17
- package/api/api/get_source.js +56 -24
- package/api/api/index.js +61 -30
- package/api/api/indices.js +1069 -859
- package/api/api/info.js +16 -17
- package/api/api/ingest.js +133 -98
- package/api/api/mget.js +51 -28
- package/api/api/msearch.js +50 -28
- package/api/api/msearch_template.js +54 -28
- package/api/api/mtermvectors.js +49 -26
- package/api/api/nodes.js +282 -156
- package/api/api/ping.js +16 -17
- package/api/api/put_script.js +41 -27
- package/api/api/rank_eval.js +38 -22
- package/api/api/reindex.js +39 -19
- package/api/api/reindex_rethrottle.js +33 -21
- package/api/api/render_search_template.js +19 -20
- package/api/api/scripts_painless_execute.js +16 -17
- package/api/api/scroll.js +32 -19
- package/api/api/search.js +109 -26
- package/api/api/search_shards.js +37 -20
- package/api/api/search_template.js +65 -28
- package/api/api/shutdown.js +67 -56
- package/api/api/snapshot.js +348 -226
- package/api/api/tasks.js +66 -48
- package/api/api/terms_enum.js +18 -19
- package/api/api/termvectors.js +58 -28
- package/api/api/update.js +65 -26
- package/api/api/update_by_query.js +90 -25
- package/api/api/update_by_query_rethrottle.js +34 -21
- package/api/index.js +268 -181
- package/api/new.d.ts +2043 -531
- package/api/opensearch_dashboards.d.ts +240 -238
- package/api/requestParams.d.ts +302 -71
- package/api/types.d.ts +6205 -5721
- package/api/utils.js +23 -24
- package/codecov.yml +2 -2
- package/index.d.ts +5203 -1037
- package/index.js +154 -143
- package/index.mjs +10 -11
- package/jenkins/release.JenkinsFile +11 -0
- package/lib/Connection.d.ts +38 -28
- package/lib/Connection.js +166 -170
- package/lib/Helpers.d.ts +108 -68
- package/lib/Helpers.js +401 -378
- package/lib/Serializer.d.ts +3 -4
- package/lib/Serializer.js +40 -41
- package/lib/Transport.d.ts +39 -15
- package/lib/Transport.js +381 -337
- package/lib/aws/AwsSigv4Signer.js +167 -0
- package/lib/aws/errors.js +24 -0
- package/lib/aws/index.d.ts +39 -0
- package/lib/aws/index.js +19 -0
- package/lib/errors.d.ts +26 -9
- package/lib/errors.js +76 -73
- package/lib/pool/BaseConnectionPool.js +101 -99
- package/lib/pool/CloudConnectionPool.js +17 -18
- package/lib/pool/ConnectionPool.js +106 -107
- package/lib/pool/index.d.ts +9 -8
- package/lib/pool/index.js +7 -8
- package/package.json +37 -15
package/.eslintignore
ADDED
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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-dupe-else-if, open an issue to track https://github.com/opensearch-project/opensearch-js/issues/240*/
|
|
22
|
+
"no-dupe-else-if": "off",
|
|
23
|
+
"no-unused-vars": [
|
|
24
|
+
"error",
|
|
25
|
+
{
|
|
26
|
+
"varsIgnorePattern": "^_.*",
|
|
27
|
+
"argsIgnorePattern": "^_.*"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
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,34 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
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).
|
|
1
|
+
# OpenSearch JavaScript Client Admins
|
|
4
2
|
|
|
5
3
|
## Current Admins
|
|
6
4
|
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
As an admin you own stewartship of the repository and its settings. Admins have [admin-level permissions on a repository](https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-permission-levels-for-an-organization). Use those privileges to serve the community and protect the repository as follows.
|
|
21
|
-
|
|
22
|
-
### Prioritize Security
|
|
23
|
-
|
|
24
|
-
Security is your number one priority. Manage security keys and safeguard access to the repository.
|
|
25
|
-
|
|
26
|
-
Note that this repository is monitored and supported 24/7 by Amazon Security, see [Reporting a Vulnerability](SECURITY.md) for details.
|
|
27
|
-
|
|
28
|
-
### Enforce Code of Conduct
|
|
29
|
-
|
|
30
|
-
Act on [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) violations by revoking access, and blocking malicious actors.
|
|
31
|
-
|
|
32
|
-
### Adopt Organizational Best Practices
|
|
33
|
-
|
|
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.
|
|
5
|
+
| Admin | GitHub ID | Affiliation |
|
|
6
|
+
|-----------------------|-----------------------------------------------|-------------|
|
|
7
|
+
| Anan Zhuang | [ananzh](https://github.com/ananzh) | Amazon |
|
|
8
|
+
| Bishoy Boktor | [boktorbb](https://github.com/boktorbb) | Amazon |
|
|
9
|
+
| Charlotte | [CEHENKLE](https://github.com/CEHENKLE) | Amazon |
|
|
10
|
+
| Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon |
|
|
11
|
+
| Kawika (Rocky) Avilla | [kavilla](https://github.com/kavilla) | Amazon |
|
|
12
|
+
| Mihir Soni | [mihirsoni](https://github.com/mihirsoni) | Amazon |
|
|
13
|
+
| Sean Neumann | [seanneumann](https://github.com/seanneumann) | Amazon |
|
|
14
|
+
|
|
15
|
+
[This document](https://github.com/opensearch-project/.github/blob/main/ADMINS.md)
|
|
16
|
+
explains what an admin's responsibilities are.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
3
|
+
|
|
4
|
+
## [Unreleased]
|
|
5
|
+
### Added
|
|
6
|
+
- Github workflow for changelog verification ([#306](https://github.com/opensearch-project/opensearch-js/pull/306))
|
|
7
|
+
- Add GitHub and Jenkins release workflow ([#317](https://github.com/opensearch-project/opensearch-js/pull/317))
|
|
8
|
+
### Dependencies
|
|
9
|
+
- Bumps `tsd` from 0.22.0 to 0.24.1
|
|
10
|
+
- Bumps `semver` from 7.3.7 to 7.3.8
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
### Deprecated
|
|
15
|
+
|
|
16
|
+
### Removed
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- Fix mutability of connection headers ([#291](https://github.com/opensearch-project/opensearch-js/issues/291))
|
|
20
|
+
|
|
21
|
+
### Security
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
[Unreleased]: https://github.com/opensearch-project/opensearch-js/compare/2.0...HEAD
|
package/COMPATIBILITY.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
| 1.3.2 | 1.1.0 |
|
|
21
|
+
| 1.3.3 | 1.1.0 |
|
|
22
|
+
| 2.0.0 | 2.0.0 |
|
|
23
|
+
| 2.0.1 | 2.0.0 |
|
|
24
|
+
|
|
25
|
+
## Upgrading
|
|
26
|
+
|
|
27
|
+
Major versions of OpenSearch introduce breaking changes that require careful upgrades of the client. While `opensearch-js` 2.0.0 works against the latest OpenSearch 1.x, 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,73 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
- [Current Maintainers](#current-maintainers)
|
|
3
|
-
- [Maintainer Responsibilities](#maintainer-responsibilities)
|
|
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
|
-
- [Be Responsive](#be-responsive)
|
|
9
|
-
- [Maintain Overall Health of the Repo](#maintain-overall-health-of-the-repo)
|
|
10
|
-
- [Use Semver](#use-semver)
|
|
11
|
-
- [Release Frequently](#release-frequently)
|
|
12
|
-
- [Promote Other Maintainers](#promote-other-maintainers)
|
|
13
|
-
|
|
14
|
-
## Overview
|
|
15
|
-
|
|
16
|
-
This document explains who the maintainers are (see below), what they do in this repo, and how they should be doing it. If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
|
|
1
|
+
# OpenSearch JavaScript Client Maintainers
|
|
17
2
|
|
|
18
3
|
## Current Maintainers
|
|
19
4
|
|
|
20
|
-
| Maintainer
|
|
21
|
-
|
|
22
|
-
| Anan Zhuang
|
|
23
|
-
| Bishoy Boktor
|
|
24
|
-
| Kawika (Rocky) Avilla
|
|
25
|
-
| Mihir Soni
|
|
26
|
-
| Sean Neumann
|
|
27
|
-
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Model the behavior set forward by the [Code of Conduct](CODE_OF_CONDUCT.md) and raise any violations to other maintainers and admins.
|
|
36
|
-
|
|
37
|
-
### Prioritize Security
|
|
38
|
-
|
|
39
|
-
Security is your number one priority. Maintainer's Github keys must be password protected securely and any reported security vulnerabilities are addressed before features or bugs.
|
|
40
|
-
|
|
41
|
-
Note that this repository is monitored and supported 24/7 by Amazon Security, see [Reporting a Vulnerability](SECURITY.md) for details.
|
|
42
|
-
|
|
43
|
-
### Review Pull Requests
|
|
44
|
-
|
|
45
|
-
Review pull requests regularly, comment, suggest, reject, merge and close. Accept only high quality pull-requests. Provide code reviews and guidance on incomming pull requests. Don't let PRs be stale and do your best to be helpful to contributors.
|
|
46
|
-
|
|
47
|
-
### Triage Open Issues
|
|
48
|
-
|
|
49
|
-
Manage labels, review issues regularly, and triage by labelling them.
|
|
50
|
-
|
|
51
|
-
All repositories in this organization have a standard set of labels, including `bug`, `documentation`, `duplicate`, `enhancement`, `good first issue`, `help wanted`, `blocker`, `invalid`, `question`, `wontfix`, and `untriaged`, along with release labels, such as `v1.0.0`, `v1.1.0` and `v2.0.0`, and `backport`.
|
|
52
|
-
|
|
53
|
-
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
|
-
### Be Responsive
|
|
56
|
-
|
|
57
|
-
Respond to enhancement requests, and forum posts. Allocate time to reviewing and commenting on issues and conversations as they come in.
|
|
58
|
-
|
|
59
|
-
### Maintain Overall Health of the Repo
|
|
60
|
-
|
|
61
|
-
Keep the `main` branch at production quality at all times. Backport features as needed. Cut release branches and tags to enable future patches.
|
|
62
|
-
|
|
63
|
-
### Use Semver
|
|
64
|
-
|
|
65
|
-
Use and enforce [semantic versioning](https://semver.org/) and do not let breaking changes be made outside of major releases.
|
|
66
|
-
|
|
67
|
-
### Release Frequently
|
|
68
|
-
|
|
69
|
-
Make frequent project releases to the community.
|
|
70
|
-
|
|
71
|
-
### Promote Other Maintainers
|
|
72
|
-
|
|
73
|
-
Assist, add, and remove [MAINTAINERS](MAINTAINERS.md). Exercise good judgement, and propose high quality contributors to become co-maintainers.
|
|
5
|
+
| Maintainer | GitHub ID | Affiliation |
|
|
6
|
+
|-----------------------|-----------------------------------------------|-------------|
|
|
7
|
+
| Anan Zhuang | [ananzh](https://github.com/ananzh) | Amazon |
|
|
8
|
+
| Bishoy Boktor | [boktorbb](https://github.com/boktorbb) | Amazon |
|
|
9
|
+
| Kawika (Rocky) Avilla | [kavilla](https://github.com/kavilla) | Amazon |
|
|
10
|
+
| Mihir Soni | [mihirsoni](https://github.com/mihirsoni) | Amazon |
|
|
11
|
+
| Sean Neumann | [seanneumann](https://github.com/seanneumann) | Amazon |
|
|
12
|
+
| Daniel Doubrovkine | [dblock](https://github.com/dblock) | Amazon |
|
|
13
|
+
| Vacha Shah | [VachaShah](https://github.com/VachaShah) | Amazon |
|
|
14
|
+
| 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/Makefile
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
cluster.opendistro.build:
|
|
2
|
-
docker-compose --project-directory .ci/opendistro build;
|
|
3
|
-
|
|
4
|
-
cluster.opendistro.start:
|
|
5
|
-
docker-compose --project-directory .ci/opendistro up -d ;
|
|
6
|
-
sleep 20;
|
|
7
|
-
|
|
8
|
-
cluster.opendistro.stop:
|
|
9
|
-
docker-compose --project-directory .ci/opendistro down ;
|
|
10
|
-
|
|
11
1
|
cluster.opensearch.build:
|
|
12
2
|
docker-compose --project-directory .ci/opensearch build;
|
|
13
3
|
|
|
14
4
|
cluster.opensearch.start:
|
|
15
5
|
docker-compose --project-directory .ci/opensearch up -d ;
|
|
16
|
-
sleep
|
|
6
|
+
sleep 60;
|
|
17
7
|
|
|
18
8
|
cluster.opensearch.stop:
|
|
19
9
|
docker-compose --project-directory .ci/opensearch down ;
|
|
@@ -24,4 +14,4 @@ cluster.clean: ## Remove unused Docker volumes and networks
|
|
|
24
14
|
docker network prune --force
|
|
25
15
|
docker system prune --volumes --force
|
|
26
16
|
|
|
27
|
-
.PHONY: cluster.
|
|
17
|
+
.PHONY: cluster.opensearch.build cluster.opensearch.start cluster.opensearch.stop cluster.clean
|
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)
|
|
@@ -20,14 +23,14 @@ OpenSearch Node.js client
|
|
|
20
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
36
|
npm i @opensearch-project/opensearch
|
|
@@ -38,139 +41,32 @@ If you prefer to add the client manually or just want to examine the source code
|
|
|
38
41
|
Then require the client:
|
|
39
42
|
|
|
40
43
|
```javascript
|
|
41
|
-
const { Client } = require('@opensearch-project/opensearch')
|
|
44
|
+
const { Client } = require('@opensearch-project/opensearch');
|
|
42
45
|
```
|
|
43
46
|
|
|
47
|
+
## Sample code
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
Please see the [USER_GUIDE](USER_GUIDE.md) for code snippets.
|
|
46
50
|
|
|
47
|
-
```javascript
|
|
48
|
-
'use strict';
|
|
49
|
-
|
|
50
|
-
var host = 'localhost';
|
|
51
|
-
var protocol = 'https';
|
|
52
|
-
var port = 9200;
|
|
53
|
-
var auth = 'admin:admin'; // For testing only. Don't store credentials in code.
|
|
54
|
-
var ca_certs_path = '/full/path/to/root-ca.pem';
|
|
55
|
-
|
|
56
|
-
// Optional client certificates if you don't want to use HTTP basic authentication.
|
|
57
|
-
// var client_cert_path = '/full/path/to/client.pem'
|
|
58
|
-
// var client_key_path = '/full/path/to/client-key.pem'
|
|
59
|
-
|
|
60
|
-
// Create a client with SSL/TLS enabled.
|
|
61
|
-
var { Client } = require('@opensearch-project/opensearch');
|
|
62
|
-
var fs = require('fs');
|
|
63
|
-
var client = new Client({
|
|
64
|
-
node: protocol + '://' + auth + '@' + host + ':' + port,
|
|
65
|
-
ssl: {
|
|
66
|
-
ca: fs.readFileSync(ca_certs_path),
|
|
67
|
-
// You can turn off certificate verification (rejectUnauthorized: false) if you're using self-signed certificates with a hostname mismatch.
|
|
68
|
-
// cert: fs.readFileSync(client_cert_path),
|
|
69
|
-
// key: fs.readFileSync(client_key_path)
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
async function search() {
|
|
74
|
-
|
|
75
|
-
// Create an index with non-default settings.
|
|
76
|
-
var index_name = 'books'
|
|
77
|
-
var settings = {
|
|
78
|
-
'settings': {
|
|
79
|
-
'index': {
|
|
80
|
-
'number_of_shards': 4,
|
|
81
|
-
'number_of_replicas': 3
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
var response = await client.indices.create({
|
|
87
|
-
index: index_name,
|
|
88
|
-
body: settings
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
console.log('Creating index:')
|
|
92
|
-
console.log(response.body)
|
|
93
|
-
|
|
94
|
-
// Add a document to the index.
|
|
95
|
-
var document = {
|
|
96
|
-
'title': 'The Outsider',
|
|
97
|
-
'author': 'Stephen King',
|
|
98
|
-
'year': '2018',
|
|
99
|
-
'genre': 'Crime fiction'
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
var id = '1'
|
|
103
|
-
|
|
104
|
-
var response = await client.index({
|
|
105
|
-
id: id,
|
|
106
|
-
index: index_name,
|
|
107
|
-
body: document,
|
|
108
|
-
refresh: true
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
console.log('Adding document:')
|
|
112
|
-
console.log(response.body)
|
|
113
|
-
|
|
114
|
-
// Search for the document.
|
|
115
|
-
var query = {
|
|
116
|
-
'query': {
|
|
117
|
-
'match': {
|
|
118
|
-
'title': {
|
|
119
|
-
'query': 'The Outsider'
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
var response = await client.search({
|
|
126
|
-
index: index_name,
|
|
127
|
-
body: query
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
console.log('Search results:')
|
|
131
|
-
console.log(response.body.hits)
|
|
132
|
-
|
|
133
|
-
// Delete the document.
|
|
134
|
-
var response = await client.delete({
|
|
135
|
-
index: index_name,
|
|
136
|
-
id: id
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
console.log('Deleting document:')
|
|
140
|
-
console.log(response.body)
|
|
141
|
-
|
|
142
|
-
// Delete the index.
|
|
143
|
-
var response = await client.indices.delete({
|
|
144
|
-
index: index_name
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
console.log('Deleting index:')
|
|
148
|
-
console.log(response.body)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
search().catch(console.log)
|
|
152
|
-
```
|
|
153
51
|
|
|
154
52
|
## Project Resources
|
|
155
53
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
54
|
+
- [Project Website](https://opensearch.org/)
|
|
55
|
+
- [Downloads](https://opensearch.org/downloads.html).
|
|
56
|
+
- [Documentation](https://opensearch.org/docs/)
|
|
57
|
+
- Need help? Try [Forums](https://discuss.opendistrocommunity.dev/)
|
|
58
|
+
- [Project Principles](https://opensearch.org/#principles)
|
|
59
|
+
- [Contributing to OpenSearch](CONTRIBUTING.md)
|
|
60
|
+
- [Maintainer Responsibilities](MAINTAINERS.md)
|
|
61
|
+
- [Release Management](RELEASING.md)
|
|
62
|
+
- [Admin Responsibilities](ADMINS.md)
|
|
63
|
+
- [Security](SECURITY.md)
|
|
64
|
+
- [NPM Page](https://www.npmjs.com/package/@opensearch-project/opensearch)
|
|
168
65
|
|
|
169
66
|
## Code of Conduct
|
|
170
67
|
|
|
171
68
|
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.
|
|
172
69
|
|
|
173
|
-
|
|
174
70
|
## License
|
|
175
71
|
|
|
176
72
|
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.
|