@opensearch-project/opensearch 1.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/.dockerignore +5 -0
- package/ADMINS.md +34 -0
- package/DEVELOPER_GUIDE.md +60 -0
- package/LICENSE.txt +201 -0
- package/MAINTAINERS.md +73 -0
- package/Makefile +27 -0
- package/NOTICE.txt +8 -0
- package/README.md +183 -0
- package/RELEASING.md +34 -0
- package/SECURITY.md +3 -0
- package/api/api/bulk.js +81 -0
- package/api/api/cat.js +525 -0
- package/api/api/clear_scroll.js +66 -0
- package/api/api/cluster.js +431 -0
- package/api/api/count.js +75 -0
- package/api/api/create.js +80 -0
- package/api/api/dangling_indices.js +126 -0
- package/api/api/delete.js +76 -0
- package/api/api/delete_by_query.js +82 -0
- package/api/api/delete_by_query_rethrottle.js +71 -0
- package/api/api/delete_script.js +67 -0
- package/api/api/exists.js +76 -0
- package/api/api/exists_source.js +85 -0
- package/api/api/explain.js +76 -0
- package/api/api/features.js +92 -0
- package/api/api/field_caps.js +66 -0
- package/api/api/get.js +76 -0
- package/api/api/get_script.js +67 -0
- package/api/api/get_script_context.js +61 -0
- package/api/api/get_script_languages.js +61 -0
- package/api/api/get_source.js +76 -0
- package/api/api/index.js +82 -0
- package/api/api/indices.js +1516 -0
- package/api/api/info.js +61 -0
- package/api/api/ingest.js +211 -0
- package/api/api/mget.js +81 -0
- package/api/api/msearch.js +81 -0
- package/api/api/msearch_template.js +81 -0
- package/api/api/mtermvectors.js +75 -0
- package/api/api/nodes.js +279 -0
- package/api/api/ping.js +61 -0
- package/api/api/put_script.js +82 -0
- package/api/api/rank_eval.js +72 -0
- package/api/api/reindex.js +67 -0
- package/api/api/reindex_rethrottle.js +71 -0
- package/api/api/render_search_template.js +66 -0
- package/api/api/scripts_painless_execute.js +61 -0
- package/api/api/scroll.js +66 -0
- package/api/api/search.js +75 -0
- package/api/api/search_shards.js +66 -0
- package/api/api/search_template.js +81 -0
- package/api/api/shutdown.js +135 -0
- package/api/api/snapshot.js +450 -0
- package/api/api/tasks.js +119 -0
- package/api/api/terms_enum.js +67 -0
- package/api/api/termvectors.js +78 -0
- package/api/api/update.js +80 -0
- package/api/api/update_by_query.js +78 -0
- package/api/api/update_by_query_rethrottle.js +71 -0
- package/api/index.js +254 -0
- package/api/new.d.ts +716 -0
- package/api/requestParams.d.ts +1583 -0
- package/api/types.d.ts +9481 -0
- package/api/utils.js +69 -0
- package/codecov.yml +14 -0
- package/index.d.ts +1210 -0
- package/index.js +338 -0
- package/index.mjs +40 -0
- package/lib/Connection.d.ts +107 -0
- package/lib/Connection.js +345 -0
- package/lib/Helpers.d.ts +135 -0
- package/lib/Helpers.js +779 -0
- package/lib/Serializer.d.ts +41 -0
- package/lib/Serializer.js +105 -0
- package/lib/Transport.d.ts +173 -0
- package/lib/Transport.js +646 -0
- package/lib/errors.d.ts +101 -0
- package/lib/errors.js +168 -0
- package/lib/pool/BaseConnectionPool.js +269 -0
- package/lib/pool/CloudConnectionPool.js +75 -0
- package/lib/pool/ConnectionPool.js +257 -0
- package/lib/pool/index.d.ts +215 -0
- package/lib/pool/index.js +41 -0
- package/package.json +102 -0
package/.dockerignore
ADDED
package/ADMINS.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
## Overview
|
|
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).
|
|
4
|
+
|
|
5
|
+
## Current Admins
|
|
6
|
+
|
|
7
|
+
| Admin | GitHub ID | Affiliation |
|
|
8
|
+
| -------------------------| --------------------------------------- | ----------- |
|
|
9
|
+
| Anan Zhuang | [ananzh](https://github.com/ananzh) | Amazon |
|
|
10
|
+
| Bishoy Boktor | [boktorbb-amzn](https://github.com/boktorbb-amzn) | Amazon |
|
|
11
|
+
| Charlotte | [CEHENKLE](https://github.com/CEHENKLE) | Amazon |
|
|
12
|
+
| Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon |
|
|
13
|
+
| Kawika (Rocky) Avilla | [kavilla](https://github.com/kavilla) | Amazon |
|
|
14
|
+
| Mihir Soni | [mihirsoni](https://github.com/mihirsoni) | Amazon |
|
|
15
|
+
| Sean Neumann | [seanneumann](https://github.com/seanneumann) | Amazon |
|
|
16
|
+
| Tommy Markley | [tmarkley](https://github.com/tmarkley) | Amazon |
|
|
17
|
+
|
|
18
|
+
## Admin Responsibilities
|
|
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.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Developer Guide
|
|
2
|
+
|
|
3
|
+
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
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
### Git Clone OpenSearch Node.js Client Repository
|
|
8
|
+
|
|
9
|
+
Fork [opensearch-project/opensearch-js](https://github.com/opensearch-project/opensearch-js) and clone locally,
|
|
10
|
+
e.g. `git clone https://github.com/[your username]/opensearch-js.git`.
|
|
11
|
+
|
|
12
|
+
### Install Prerequisites
|
|
13
|
+
|
|
14
|
+
#### Node.js
|
|
15
|
+
The minimum supported version of Node.js is v10.
|
|
16
|
+
|
|
17
|
+
#### Docker
|
|
18
|
+
|
|
19
|
+
[Docker](https://docs.docker.com/install/) is required for building some OpenSearch artifacts and executing integration tests.
|
|
20
|
+
|
|
21
|
+
### Unit Testing
|
|
22
|
+
Go to your terminal and run:
|
|
23
|
+
```
|
|
24
|
+
cd folder-path
|
|
25
|
+
npm run test:unit
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
To run a specific unit test, you can use the following jest command. `npm test` will not work.
|
|
29
|
+
```
|
|
30
|
+
cd folder-path/to/test
|
|
31
|
+
jest TestName
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If you don't have jest, you can install it via npm or yarn
|
|
35
|
+
```
|
|
36
|
+
npm i -g jest-cli
|
|
37
|
+
yarn global add jest-cli
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Integration Testing
|
|
41
|
+
In order to test opensearch-js client, you need a running OpenSearch cluster. You can use Docker to accomplish this.
|
|
42
|
+
The [Docker Compose file](.ci/opensearch/docker-compose.yml) supports the ability to run integration tests for the project in local environments.
|
|
43
|
+
If you have not installed docker-compose, you can install it from this [link](https://docs.docker.com/compose/install/).
|
|
44
|
+
|
|
45
|
+
#### Execute integration tests from your terminal
|
|
46
|
+
|
|
47
|
+
1. Run below command to start containers. By default, it will launch latest OpenSearch cluster.
|
|
48
|
+
```
|
|
49
|
+
cd folder-path/.ci/opensearch
|
|
50
|
+
docker-compose up
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
2. Run all integration tests.
|
|
54
|
+
```
|
|
55
|
+
npm run test:integration:helpers
|
|
56
|
+
```
|
|
57
|
+
5. Stop and clean containers.
|
|
58
|
+
```
|
|
59
|
+
docker-compose down
|
|
60
|
+
```
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/MAINTAINERS.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
- [Overview](#overview)
|
|
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).
|
|
17
|
+
|
|
18
|
+
## Current Maintainers
|
|
19
|
+
|
|
20
|
+
| Maintainer | GitHub ID | Affiliation |
|
|
21
|
+
| ------------------------ | --------------------------------------- | ----------- |
|
|
22
|
+
| Anan Zhuang | [ananzh](https://github.com/ananzh) | Amazon |
|
|
23
|
+
| Bishoy Boktor | [boktorbb-amzn](https://github.com/boktorbb-amzn) | Amazon |
|
|
24
|
+
| Kawika (Rocky) Avilla | [kavilla](https://github.com/kavilla) | Amazon |
|
|
25
|
+
| Mihir Soni | [mihirsoni](https://github.com/mihirsoni) | Amazon |
|
|
26
|
+
| Sean Neumann | [seanneumann](https://github.com/seanneumann) | Amazon |
|
|
27
|
+
| Tommy Markley | [tmarkley](https://github.com/tmarkley) | Amazon |
|
|
28
|
+
|
|
29
|
+
## Maintainer Responsibilities
|
|
30
|
+
|
|
31
|
+
Maintainers are active and visible members of the community, and have [maintain-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 evolve code as follows.
|
|
32
|
+
|
|
33
|
+
### Uphold Code of Conduct
|
|
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.
|
package/Makefile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
cluster.opensearch.build:
|
|
12
|
+
docker-compose --project-directory .ci/opensearch build;
|
|
13
|
+
|
|
14
|
+
cluster.opensearch.start:
|
|
15
|
+
docker-compose --project-directory .ci/opensearch up -d ;
|
|
16
|
+
sleep 20;
|
|
17
|
+
|
|
18
|
+
cluster.opensearch.stop:
|
|
19
|
+
docker-compose --project-directory .ci/opensearch down ;
|
|
20
|
+
|
|
21
|
+
cluster.clean: ## Remove unused Docker volumes and networks
|
|
22
|
+
@printf "\033[2m→ Cleaning up Docker assets...\033[0m\n"
|
|
23
|
+
docker volume prune --force
|
|
24
|
+
docker network prune --force
|
|
25
|
+
docker system prune --volumes --force
|
|
26
|
+
|
|
27
|
+
.PHONY: cluster.opendistro.build cluster.opendistro.start cluster.opendistro.stop cluster.opensearch.build cluster.opensearch.start cluster.opensearch.stop cluster.clean
|
package/NOTICE.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
OpenSearch (https://opensearch.org/)
|
|
2
|
+
Copyright OpenSearch Contributors
|
|
3
|
+
|
|
4
|
+
This product includes software developed by
|
|
5
|
+
Elasticsearch (http://www.elastic.co).
|
|
6
|
+
|
|
7
|
+
This product includes software developed by The Apache Software
|
|
8
|
+
Foundation (http://www.apache.org/).
|
package/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
[](https://github.com/opensearch-project/opensearch-js/actions/workflows/nodejs.yml)
|
|
2
|
+
[](https://github.com/opensearch-project/opensearch-js/actions/workflows/integration.yml)
|
|
3
|
+
[](https://github.com/opensearch-project/opensearch-js/actions/workflows/bundler.yml)
|
|
4
|
+
[](https://codecov.io/gh/opensearch-project/opensearch-js)
|
|
5
|
+
[](https://discuss.opendistrocommunity.dev/c/clients/)
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
OpenSearch Node.js client
|
|
11
|
+
|
|
12
|
+
- [Welcome!](#welcome)
|
|
13
|
+
- [Project Resources](#project-resources)
|
|
14
|
+
- [Code of Conduct](#code-of-conduct)
|
|
15
|
+
- [License](#license)
|
|
16
|
+
- [Copyright](#copyright)
|
|
17
|
+
|
|
18
|
+
## Welcome!
|
|
19
|
+
|
|
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/).
|
|
21
|
+
|
|
22
|
+
## Example use
|
|
23
|
+
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
|
+
|
|
25
|
+
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
|
+
|
|
27
|
+
|
|
28
|
+
### Setup
|
|
29
|
+
|
|
30
|
+
# To add the client to your project, install it with npm:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install https://github.com/opensearch-project/opensearch-js
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
_Note: this module will be added to the NPM registry in the coming weeks._
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
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
|
+
|
|
42
|
+
Then require the client:
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
const { Client } = require('@opensearch-project/opensearch')
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Sample code
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
'use strict';
|
|
53
|
+
|
|
54
|
+
var host = 'localhost';
|
|
55
|
+
var protocol = 'https';
|
|
56
|
+
var port = 9200;
|
|
57
|
+
var auth = 'admin:admin'; // For testing only. Don't store credentials in code.
|
|
58
|
+
var ca_certs_path = '/full/path/to/root-ca.pem';
|
|
59
|
+
|
|
60
|
+
// Optional client certificates if you don't want to use HTTP basic authentication.
|
|
61
|
+
// var client_cert_path = '/full/path/to/client.pem'
|
|
62
|
+
// var client_key_path = '/full/path/to/client-key.pem'
|
|
63
|
+
|
|
64
|
+
// Create a client with SSL/TLS enabled.
|
|
65
|
+
var { Client } = require('@opensearch-project/opensearch');
|
|
66
|
+
var fs = require('fs');
|
|
67
|
+
var client = new Client({
|
|
68
|
+
node: protocol + '://' + auth + '@' + host + ':' + port,
|
|
69
|
+
ssl: {
|
|
70
|
+
ca: fs.readFileSync(ca_certs_path),
|
|
71
|
+
// You can turn off certificate verification (rejectUnauthorized: false) if you're using self-signed certificates with a hostname mismatch.
|
|
72
|
+
// cert: fs.readFileSync(client_cert_path),
|
|
73
|
+
// key: fs.readFileSync(client_key_path)
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
async function search() {
|
|
78
|
+
|
|
79
|
+
// Create an index with non-default settings.
|
|
80
|
+
var index_name = 'books'
|
|
81
|
+
var settings = {
|
|
82
|
+
'settings': {
|
|
83
|
+
'index': {
|
|
84
|
+
'number_of_shards': 4,
|
|
85
|
+
'number_of_replicas': 3
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var response = await client.indices.create({
|
|
91
|
+
index: index_name,
|
|
92
|
+
body: settings
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
console.log('Creating index:')
|
|
96
|
+
console.log(response.body)
|
|
97
|
+
|
|
98
|
+
// Add a document to the index.
|
|
99
|
+
var document = {
|
|
100
|
+
'title': 'The Outsider',
|
|
101
|
+
'author': 'Stephen King',
|
|
102
|
+
'year': '2018',
|
|
103
|
+
'genre': 'Crime fiction'
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
var id = '1'
|
|
107
|
+
|
|
108
|
+
var response = await client.index({
|
|
109
|
+
id: id,
|
|
110
|
+
index: index_name,
|
|
111
|
+
body: document,
|
|
112
|
+
refresh: true
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
console.log('Adding document:')
|
|
116
|
+
console.log(response.body)
|
|
117
|
+
|
|
118
|
+
// Search for the document.
|
|
119
|
+
var query = {
|
|
120
|
+
'query': {
|
|
121
|
+
'match': {
|
|
122
|
+
'title': {
|
|
123
|
+
'query': 'The Outsider'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
var response = await client.search({
|
|
130
|
+
index: index_name,
|
|
131
|
+
body: query
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
console.log('Search results:')
|
|
135
|
+
console.log(response.body.hits)
|
|
136
|
+
|
|
137
|
+
// Delete the document.
|
|
138
|
+
var response = await client.delete({
|
|
139
|
+
index: index_name,
|
|
140
|
+
id: id
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
console.log('Deleting document:')
|
|
144
|
+
console.log(response.body)
|
|
145
|
+
|
|
146
|
+
// Delete the index.
|
|
147
|
+
var response = await client.indices.delete({
|
|
148
|
+
index: index_name
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
console.log('Deleting index:')
|
|
152
|
+
console.log(response.body)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
search().catch(console.log)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Project Resources
|
|
159
|
+
|
|
160
|
+
* [Project Website](https://opensearch.org/)
|
|
161
|
+
* [Downloads](https://opensearch.org/downloads.html).
|
|
162
|
+
* [Documentation](https://opensearch.org/docs/)
|
|
163
|
+
* Need help? Try [Forums](https://discuss.opendistrocommunity.dev/)
|
|
164
|
+
* [Project Principles](https://opensearch.org/#principles)
|
|
165
|
+
* [Contributing to OpenSearch](CONTRIBUTING.md)
|
|
166
|
+
* [Maintainer Responsibilities](MAINTAINERS.md)
|
|
167
|
+
* [Release Management](RELEASING.md)
|
|
168
|
+
* [Admin Responsibilities](ADMINS.md)
|
|
169
|
+
* [Security](SECURITY.md)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
## Code of Conduct
|
|
173
|
+
|
|
174
|
+
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
|
+
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
This project is licensed under the [Apache v2.0 License](LICENSE.txt).
|
|
180
|
+
|
|
181
|
+
## Copyright
|
|
182
|
+
|
|
183
|
+
Copyright OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details.
|
package/RELEASING.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
- [Overview](#overview)
|
|
2
|
+
- [Branching](#branching)
|
|
3
|
+
- [Release Branching](#release-branching)
|
|
4
|
+
- [Feature Branches](#feature-branches)
|
|
5
|
+
- [Release Labels](#release-labels)
|
|
6
|
+
- [Releasing](#releasing)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This document explains the release strategy for artifacts in this organization.
|
|
11
|
+
|
|
12
|
+
## Branching
|
|
13
|
+
|
|
14
|
+
### Release Branching
|
|
15
|
+
|
|
16
|
+
Given the current major release of 1.0, projects in this organization maintain the following active branches.
|
|
17
|
+
|
|
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
|
+
|
|
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
|
+
|
|
24
|
+
### Feature Branches
|
|
25
|
+
|
|
26
|
+
Do not creating branches in the upstream repo, use your fork, for the exception of long lasting feature branches that require active collaboration from multiple developers. Name feature branches `feature/<thing>`. Once the work is merged to `main`, please make sure to delete the feature branch.
|
|
27
|
+
|
|
28
|
+
## Release Labels
|
|
29
|
+
|
|
30
|
+
Repositories create consistent release labels, such as `v1.0.0`, `v1.1.0` and `v2.0.0`, as well as `patch` and `backport`. Use release labels to target an issue or a PR for a given release. See [MAINTAINERS](MAINTAINERS.md#triage-open-issues) for more information on triaging issues.
|
|
31
|
+
|
|
32
|
+
## Releasing
|
|
33
|
+
|
|
34
|
+
The release process is standard across repositories in this org and is run by a release manager volunteering from amongst [MAINTAINERS](MAINTAINERS.md).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
## Reporting a Vulnerability
|
|
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.
|