From cf73f7d326eadac6f3eaf25098c79f8e65ff8874 Mon Sep 17 00:00:00 2001 From: Mital Awachat Date: Fri, 6 Aug 2021 09:11:49 +0530 Subject: [PATCH] Basic templates (#13) * Basic templates * Rename elasticsearch to opensearch in .ci Signed-off-by: Mital Awachat --- .ci/Dockerfile | 11 ++- .ci/make.sh | 17 +++- .github/ISSUE_TEMPLATE/BUG_TEMPLATE.md | 31 ++++++ .../FEATURE_REQUEST_TEMPLATE.md | 18 ++++ .github/ISSUE_TEMPLATE/PROPOSAL_TEMPLATE.md | 21 +++++ .github/ISSUE_TEMPLATE/config.yml | 7 ++ ADMINS.md | 29 ++++++ CODE_OF_CONDUCT.md | 25 +++++ CONTRIBUTING.md | 93 ++++++++++++++---- MAINTAINERS.md | 70 ++++++++++++++ OpenSearch.svg | 1 + README.md | 94 ++++++++++++++++--- RELEASING.md | 34 +++++++ SECURITY.md | 3 + build.gradle.kts | 2 +- 15 files changed, 420 insertions(+), 36 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/BUG_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/FEATURE_REQUEST_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/PROPOSAL_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 ADMINS.md create mode 100644 CODE_OF_CONDUCT.md create mode 100644 MAINTAINERS.md create mode 100644 OpenSearch.svg create mode 100644 RELEASING.md create mode 100644 SECURITY.md diff --git a/.ci/Dockerfile b/.ci/Dockerfile index 1fcb0eeffb..1379273757 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -1,4 +1,10 @@ # +# SPDX-License-Identifier: Apache-2.0 +# +# The OpenSearch Contributors require contributions made to +# this file be licensed under the Apache-2.0 license or a +# compatible open source license. +# # Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright @@ -16,13 +22,16 @@ # specific language governing permissions and limitations # under the License. # +# Modifications Copyright OpenSearch Contributors. See +# GitHub history for details. +# # Build a Docker image that has Gradle and all project dependencies ready. # Needs to be run with .git and java-client/src mounted under /elasticsearch-java. FROM openjdk:15 -WORKDIR /elasticsearch-java/ +WORKDIR /opensearch-java/ # Download and initialize Gradle COPY gradlew ./ diff --git a/.ci/make.sh b/.ci/make.sh index 26392fb4c0..84f94aef38 100755 --- a/.ci/make.sh +++ b/.ci/make.sh @@ -1,5 +1,11 @@ #!/usr/bin/env bash # +# SPDX-License-Identifier: Apache-2.0 +# +# The OpenSearch Contributors require contributions made to +# this file be licensed under the Apache-2.0 license or a +# compatible open source license. +# # Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright @@ -17,6 +23,9 @@ # specific language governing permissions and limitations # under the License. # +# Modifications Copyright OpenSearch Contributors. See +# GitHub history for details. +# # ------------------------------------------------------- # # @@ -53,7 +62,7 @@ VERSION=$2 STACK_VERSION=$VERSION set -euo pipefail -product="elastic/elasticsearch-java" +product="opensearch/opensearch-java" output_folder=".ci/output" codegen_folder=".ci/output" OUTPUT_DIR="$repo/${output_folder}" @@ -130,9 +139,9 @@ esac # ------------------------------------------------------- # docker_image=${product}-build-$(echo "$VERSION" | tr '[:upper:]' '[:lower:]') -git_mount="-v $repo/.git:/elasticsearch-java/.git:ro" -src_mount="-v $repo/java-client/src:/elasticsearch-java/java-client/src:ro" -output_mount="-v $repo/.ci/output:/elasticsearch-java/build" +git_mount="-v $repo/.git:/opensearch-java/.git:ro" +src_mount="-v $repo/java-client/src:/opensearch-java/java-client/src:ro" +output_mount="-v $repo/.ci/output:/opensearch-java/build" build_image() { echo -e "\033[34;1mINFO: building $product container\033[0m" diff --git a/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md b/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md new file mode 100644 index 0000000000..29eddb95ee --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md @@ -0,0 +1,31 @@ +--- +name: 🐛 Bug report +about: Create a report to help us improve +title: '[BUG]' +labels: 'bug, untriaged' +assignees: '' +--- + +**What is the bug?** +A clear and concise description of the bug. + +**How can one reproduce the bug?** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**What is the expected behavior?** +A clear and concise description of what you expected to happen. + +**What is your host/environment?** + - OS: [e.g. iOS] + - Version [e.g. 22] + - Plugins + +**Do you have any screenshots?** +If applicable, add screenshots to help explain your problem. + +**Do you have any additional context?** +Add any other context about the problem. diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST_TEMPLATE.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..be38cd2c69 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST_TEMPLATE.md @@ -0,0 +1,18 @@ +--- +name: 🎆 Feature request +about: Request a feature in this project +title: '[FEATURE]' +labels: enhancement +assignees: '' +--- +**Is your feature request related to a problem?** +A clear and concise description of what the problem is, e.g. _I'm always frustrated when [...]_ + +**What solution would you like?** +A clear and concise description of what you want to happen. + +**What alternatives have you considered?** +A clear and concise description of any alternative solutions or features you've considered. + +**Do you have any additional context?** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/PROPOSAL_TEMPLATE.md b/.github/ISSUE_TEMPLATE/PROPOSAL_TEMPLATE.md new file mode 100644 index 0000000000..1f89124259 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/PROPOSAL_TEMPLATE.md @@ -0,0 +1,21 @@ +--- +name: 💭 Proposal +about: Suggest an idea for a specific feature you wish to propose to the community for comment +title: '[PROPOSAL]' +labels: proposal +assignees: '' +--- +## What kind of business use case are you trying to solve? What are your requirements? +A clear and concise description of the business problem, e.g. _My customers are asking for [...]_ + +**What is the problem? What is preventing you from meeting the requirements?** +Describe what impact this problem has for lack of a solution. + +**What are you proposing? What do you suggest we do to solve the problem or improve the existing situation?** +Describe your proposed solution. It's OK if you don't have one. + +**What are your assumptions or prerequisites?** +Describe any assumptions you may be making that would limit the scope of this proposal. + +**What are remaining open questions?** +List questions that may need to be answered before proceeding with an implementation. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..67f6e2a326 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,7 @@ +contact_links: + - name: OpenSearch Community Support + url: https://discuss.opendistrocommunity.dev/ + about: Please ask and answer questions here. + - name: AWS/Amazon Security + url: https://aws.amazon.com/security/vulnerability-reporting/ + about: Please report security vulnerabilities here. diff --git a/ADMINS.md b/ADMINS.md new file mode 100644 index 0000000000..c37afe11cd --- /dev/null +++ b/ADMINS.md @@ -0,0 +1,29 @@ +## Overview + +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). + +## Current Admins + +| Admin | GitHub ID | Affiliation | +| -------------------------| --------------------------------------- | ----------- | +| Charlotte | [CEHENKLE](https://github.com/CEHENKLE) | Amazon | +| Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon | + + +## Admin Responsibilities + +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. + +### Prioritize Security + +Security is your number one priority. Manage security keys and safeguard access to the repository. + +Note that this repository is monitored and supported 24/7 by Amazon Security, see [Reporting a Vulnerability](SECURITY.md) for details. + +### Enforce Code of Conduct + +Act on [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) violations by revoking access, and blocking malicious actors. + +### Adopt Organizational Best Practices + +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. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..997bae660b --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,25 @@ + +This code of conduct applies to all spaces provided by the OpenSource project including in code, documentation, issue trackers, mailing lists, chat channels, wikis, blogs, social media and any other communication channels used by the project. + + +**Our open source communities endeavor to:** + +* Be Inclusive: We are committed to being a community where everyone can join and contribute. This means using inclusive and welcoming language. +* Be Welcoming: We are committed to maintaining a safe space for everyone to be able to contribute. +* Be Respectful: We are committed to encouraging differing viewpoints, accepting constructive criticism and work collaboratively towards decisions that help the project grow. Disrespectful and unacceptable behavior will not be tolerated. +* Be Collaborative: We are committed to supporting what is best for our community and users. When we build anything for the benefit of the project, we should document the work we do and communicate to others on how this affects their work. + + +**Our Responsibility. As contributors, members, or bystanders we each individually have the responsibility to behave professionally and respectfully at all times. Disrespectful and unacceptable behaviors include, but are not limited to:** + +* The use of violent threats, abusive, discriminatory, or derogatory language; +* Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, race, political or religious affiliation; +* Posting of sexually explicit or violent content; +* The use of sexualized language and unwelcome sexual attention or advances; +* Public or private harassment of any kind; +* Publishing private information, such as physical or electronic address, without permission; +* Other conduct which could reasonably be considered inappropriate in a professional setting; +* Advocating for or encouraging any of the above behaviors. +* Enforcement and Reporting Code of Conduct Issues: + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported. [Contact us](mailto:opensource-codeofconduct@amazon.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4b652a128d..7aab00fba5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,30 +1,91 @@ -# Contributing +- [Contributing to OpenSearch](#contributing-to-opensearch) +- [First Things First](#first-things-first) +- [Ways to Contribute](#ways-to-contribute) + - [Bug Reports](#bug-reports) + - [Feature Requests](#feature-requests) + - [Contributing Code](#contributing-code) +- [Developer Certificate of Origin](#developer-certificate-of-origin) +- [Review Process](#review-process) -The Elasticsearch Java client is open source and we love to receive contributions from our community. +## Contributing to OpenSearch -There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests or writing code. +OpenSearch is a community project that is built and maintained by people just like **you**. We're glad you're interested in helping out. There are several different ways you can do it, but before we talk about that, let's talk about how to get started. -## Sign the Contributor License Agreement +## First Things First -We do ask that you sign the [Contiributor License Agreement](https://www.elastic.co/contributor-agreement) -before we can accept pull requests from you. +1. **When in doubt, open an issue** - For almost any type of contribution, the first step is opening an issue. Even if you think you already know what the solution is, writing down a description of the problem you're trying to solve will help everyone get context when they review your pull request. If it's truly a trivial change (e.g. spelling error), you can skip this step -- but as the subject says, when it doubt, [open an issue](issues). -## Development +2. **Only submit your own work** (or work you have sufficient rights to submit) - Please make sure that any code or documentation you submit is your work or you have the rights to submit. We respect the intellectual property rights of others, and as part of contributing, we'll ask you to sign your contribution with a "Developer Certificate of Origin" (DCO) that states you have the rights to submit this work and you understand we'll use your contribution. There's more information about this topic in the [DCO section](#developer-certificate-of-origin). -### Prerequisites +## Ways to Contribute -You need at least Java 11 to build the project, even though the code targets Java 8. The project is built with `Gradle`. You don't have to install it, and can use the provided `gradlew` that will install the required version if needed. +### Bug Reports -Docker is used for some tests to spawn an Elasticsearch server. +Ugh! Bugs! -### Project structure +A bug is when software behaves in a way that you didn't expect and the developer didn't intend. To help us understand what's going on, we first want to make sure you're working from the latest version. -This is a multi-project build. The Java client is in the [`java-client`](./java-client) subproject. Additional subprojects will come with more extensive API tests and examples. +Once you've confirmed that the bug still exists in the latest version, you'll want to check to make sure it's not something we already know about on the [open issues GitHub page](issues). -The `org.opensearch.clients.opensearch` package and its children are all entirely generated, and the generator is not part of this repository. Because of this, PRs will not work for this part of the code. If you want to suggest changes to the generated code, open an issue describing how the code should look like, so that we can discuss on updating the generator. +If you've upgraded to the latest version and you can't find it in our open issues list, then you'll need to tell us how to reproduce it Provide as much information as you can. You may think that the problem lies with your query, when actually it depends on how your data is indexed. The easier it is for us to recreate your problem, the faster it is likely to be fixed. -Other packages contain support classes and frameworks that provide the plumbing between the generated code and the http client and JSON object mapping libraries. PRs are more than welcome on code in these packages. +### Feature Requests -### Before you open a PR +If you've thought of a way that OpenSearch could be better, we want to hear about it. We track feature requests using GitHub, so please feel free to open an issue which describes the feature you would like to see, why you need it, and how it should work. -To save everybody's time, please make sure that `./gradlew check` is successful before opening a PR with your changes. This will check the code style and run the tests. + +### Contributing Code + +As with other types of contributions, the first step is to [open an issue on GitHub](issues/new/choose). Opening an issue before you make changes makes sure that someone else isn't already working on that particular problem. It also lets us all work together to find the right approach before you spend a bunch of time on a PR. So again, when in doubt, open an issue. + +## Developer Certificate of Origin + +OpenSearch is an open source product released under the Apache 2.0 license (see either [the Apache site](https://www.apache.org/licenses/LICENSE-2.0) or the [LICENSE.txt file](LICENSE.txt)). The Apache 2.0 license allows you to freely use, modify, distribute, and sell your own products that include Apache 2.0 licensed software. + +We respect intellectual property rights of others and we want to make sure all incoming contributions are correctly attributed and licensed. A Developer Certificate of Origin (DCO) is a lightweight mechanism to do that. + +The DCO is a declaration attached to every contribution made by every developer. In the commit message of the contribution, the developer simply adds a `Signed-off-by` statement and thereby agrees to the DCO, which you can find below or at [DeveloperCertificate.org](http://developercertificate.org/). + +``` +Developer's Certificate of Origin 1.1 +By making a contribution to this project, I certify that: +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or +(b) The contribution is based upon previous work that, to the + best of my knowledge, is covered under an appropriate open + source license and I have the right under that license to + submit that work with modifications, whether created in whole + or in part by me, under the same open source license (unless + I am permitted to submit under a different license), as + Indicated in the file; or +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including + all personal information I submit with it, including my + sign-off) is maintained indefinitely and may be redistributed + consistent with this project or the open source license(s) + involved. + ``` + +We require that every contribution to OpenSearch is signed with a Developer Certificate of Origin. Additionally, please use your real name. We do not accept anonymous contributors nor those utilizing pseudonyms. + +Each commit must include a DCO which looks like this + +``` +Signed-off-by: Jane Smith +``` + +You may type this line on your own when writing your commit messages. However, if your user.name and user.email are set in your git configs, you can use `-s` or `– – signoff` to add the `Signed-off-by` line to the end of the commit message. + +## Review Process + +We deeply appreciate everyone who takes the time to make a contribution. We will review all contributions as quickly as possible. As a reminder, [opening an issue](issues/new/choose) discussing your change before you make it is the best way to smooth the PR process. This will prevent a rejection because someone else is already working on the problem, or because the solution is incompatible with the architectural direction. + +During the PR process, expect that there will be some back-and-forth. Please try to respond to comments in a timely fashion, and if you don't wish to continue with the PR, let us know. If a PR takes too many iterations for its complexity or size, we may reject it. Additionally, if you stop responding we may close the PR as abandoned. In either case, if you feel this was done in error, please add a comment on the PR. + +If we accept the PR, a [maintainer](MAINTAINERS.md) will merge your change and usually take care of backporting it to appropriate branches ourselves. + +If we reject the PR, we will close the pull request with a comment explaining why. This decision isn't always final: if you feel we have misunderstood your intended change or otherwise think that we should reconsider then please continue the conversation with a comment on the PR and we'll do our best to address any further points you raise. diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 0000000000..f2e8022abd --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,70 @@ +- [Overview](#overview) +- [Current Maintainers](#current-maintainers) +- [Maintainer Responsibilities](#maintainer-responsibilities) + - [Uphold Code of Conduct](#uphold-code-of-conduct) + - [Prioritize Security](#prioritize-security) + - [Review Pull Requests](#review-pull-requests) + - [Triage Open Issues](#triage-open-issues) + - [Be Responsive](#be-responsive) + - [Maintain Overall Health of the Repo](#maintain-overall-health-of-the-repo) + - [Use Semver](#use-semver) + - [Release Frequently](#release-frequently) + - [Promote Other Maintainers](#promote-other-maintainers) + +## Overview + +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). + +## Current Maintainers + +| Maintainer | GitHub ID | Affiliation | +| ------------------------ | ----------------------------------------------- | ----------- | +| Mital Awachat | [mitalawachat](https://github.com/mitalawachat) | Amazon | +| Bukhtawar Khan | [Bukhtawar](https://github.com/Bukhtawar) | Amazon | +| Vamshi Vijay Nakkirtha | [vamshin](https://github.com/vamshin) | Amazon | + +## Maintainer Responsibilities + +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. + +### Uphold Code of Conduct + +Model the behavior set forward by the [Code of Conduct](CODE_OF_CONDUCT.md) and raise any violations to other maintainers and admins. + +### Prioritize Security + +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. + +Note that this repository is monitored and supported 24/7 by Amazon Security, see [Reporting a Vulnerability](SECURITY.md) for details. + +### Review Pull Requests + +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. + +### Triage Open Issues + +Manage labels, review issues regularly, and triage by labelling them. + +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`. + +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. + +### Be Responsive + +Respond to enhancement requests, and forum posts. Allocate time to reviewing and commenting on issues and conversations as they come in. + +### Maintain Overall Health of the Repo + +Keep the `main` branch at production quality at all times. Backport features as needed. Cut release branches and tags to enable future patches. + +### Use Semver + +Use and enforce [semantic versioning](https://semver.org/) and do not let breaking changes be made outside of major releases. + +### Release Frequently + +Make frequent project releases to the community. + +### Promote Other Maintainers + +Assist, add, and remove [MAINTAINERS](MAINTAINERS.md). Exercise good judgement, and propose high quality contributors to become co-maintainers. diff --git a/OpenSearch.svg b/OpenSearch.svg new file mode 100644 index 0000000000..ad4c18df2d --- /dev/null +++ b/OpenSearch.svg @@ -0,0 +1 @@ + diff --git a/README.md b/README.md index 94ec73e145..569d107e4c 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,91 @@ -Elastic logo +[![Code style and license headers](https://github.com/opensearch-project/opensearch-java/actions/workflows/checkstyle.yml/badge.svg?branch=main)](https://github.com/opensearch-project/opensearch-java/actions/workflows/checkstyle.yml) +[![Build](https://github.com/opensearch-project/opensearch-java/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/opensearch-project/opensearch-java/actions/workflows/build.yml) +[![Chat](https://img.shields.io/badge/chat-on%20forums-blue)](https://discuss.opendistrocommunity.dev/c/clients/) +![PRs welcome!](https://img.shields.io/badge/PRs-welcome!-success) -# Elasticsearch Java Client +![OpenSearch logo](OpenSearch.svg) -The official Java client for [Elasticsearch](https://github.com/elastic/elasticsearch). +OpenSearch Java Client -The Java client for Elasticsearch provides strongly typed requests and responses for all Elasticsearch APIs. It delegates protocol handling to an http client such as the [Elasticsearch Low Level REST client](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-low.html) that takes care of all transport-level concerns (http connection establishment and pooling, retries, etc). +- [Welcome!](#welcome) +- [Project Resources](#project-resources) +- [Code of Conduct](#code-of-conduct) +- [License](#license) +- [Copyright](#copyright) -The `docs/design` folder contains records of the major decisions in the design of the API. Most notably: +## Welcome! -- Object construction is based on the [builder pattern](https://www.informit.com/articles/article.aspx?p=1216151). -- Nested objects can be constructed with builder lambdas, allowing for clean and expressive DSL-like code. -- Optional values are represented as `null` with `@Nullable` annotations instead of the newer `Optional`, the Java ecosystem being still very null-based. +**opensearch-java** is [a community-driven, open source fork](https://aws.amazon.com/blogs/opensource/introducing-opensearch/) of elasticsearch-java licensed under the [Apache v2.0 License](LICENSE.txt). +For more information, see [opensearch.org](https://opensearch.org/). +This client is meant to replace the existing [OpenSearch Java High Level REST Client](https://opensearch.org/docs/latest/clients/java-rest-high-level/). -## Documentation -Please refer to [the full documentation on elastic.co](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/index.html) for comprehensive information. +**Note: This project is in beta stage and is for testing and feedback purposes only.** +## Project Resources -## Contributing +* [Project Website](https://opensearch.org/) +* [Downloads](https://opensearch.org/downloads.html). +* [Documentation](https://opensearch.org/docs/) +* Need help? Try [Forums](https://discuss.opendistrocommunity.dev/) +* [Project Principles](https://opensearch.org/#principles) +* [Contributing to OpenSearch](CONTRIBUTING.md) +* [Maintainer Responsibilities](MAINTAINERS.md) +* [Release Management](RELEASING.md) +* [Admin Responsibilities](ADMINS.md) +* [Security](SECURITY.md) -See [CONTRIBUTING.md](./CONTRIBUTING.md) +## Setup -## Licence +1. Set `JAVA_HOME` to point to a JDK >= 11 +2. Checkout and build the [opensearch-java](https://github.com/opensearch-project/opensearch-java) project. +```shell +git clone https://github.com/opensearch-project/opensearch-java.git +cd opensearch-java +./gradlew build +``` +3. Launch Intellij IDEA, choose Import Project, and select the `settings.gradle.kts` file in the root of this project. -This software is licensed under the [Apache License 2.0](https://github.com/elastic/elasticsearch-java/blob/main/LICENSE). +## Example + +```java +try (RestClient restClient = RestClient.builder(new HttpHost("localhost", 9200)).build()) { + String index = "test-index"; + + // Create Client + Transport transport = new RestClientTransport(restClient, new JacksonJsonpMapper()); + OpenSearchClient client = new OpenSearchClient(transport); + + // Create Index + CreateRequest createIndexRequest = new CreateRequest.Builder().index(index).build(); + CreateResponse createIndexResponse = client.indices().create(createIndexRequest); + assert createIndexResponse.acknowledged(); + + // Index Document + IndexData indexData = new IndexData("foo", "bar"); + IndexRequest indexRequest = new IndexRequest.Builder().index(index).id("1").value(indexData).build(); + IndexResponse indexResponse = client.index(indexRequest); + assert Objects.equals(indexResponse.id(), "1"); + + // Search Documents + SearchResponse searchResponse = client.search(s -> s.index(index), IndexData.class); + assert !searchResponse.hits().hits().isEmpty(); + searchResponse.hits().hits().stream().map(Hit::source).forEach(System.out::println); + + // Delete Index + DeleteRequest deleteRequest = new DeleteRequest.Builder().index(index).build(); + DeleteResponse deleteResponse = client.indices().delete(deleteRequest); + assert deleteResponse.acknowledged(); +} +``` + +## Code of Conduct + +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. + +## License + +This project is licensed under the [Apache v2.0 License](LICENSE.txt). + +## Copyright + +Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000000..674cc21165 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,34 @@ +- [Overview](#overview) +- [Branching](#branching) + - [Release Branching](#release-branching) + - [Feature Branches](#feature-branches) +- [Release Labels](#release-labels) +- [Releasing](#releasing) + +## Overview + +This document explains the release strategy for artifacts in this organization. + +## Branching + +### Release Branching + +Given the current major release of 1.0, projects in this organization maintain the following active branches. + +* **main**: The next _major_ release. This is the branch where all merges take place and code moves fast. +* **1.x**: The next _minor_ release. Once a change is merged into `main`, decide whether to backport it to `1.x`. +* **1.0**: The _current_ release. In between minor releases, only hotfixes (e.g. security) are backported to `1.0`. + +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. + +### Feature Branches + +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/`. Once the work is merged to `main`, please make sure to delete the feature branch. + +## Release Labels + +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. + +## Releasing + +The release process is standard across repositories in this org and is run by a release manager volunteering from amongst [MAINTAINERS](MAINTAINERS.md). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000000..b862921043 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,3 @@ +## Reporting a Vulnerability + +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. diff --git a/build.gradle.kts b/build.gradle.kts index c77132b138..a07f3d5be3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -70,7 +70,7 @@ tasks.register(name = "resolveDependencies") { tasks.register(name = "publishForReleaseManager") { group = "Publishing" - description = "Publishes artifacts in a format suitable for the Elastic release manager" + description = "Publishes artifacts in a format suitable for the release manager" dependsOn( ":java-client:publishAllPublicationsToBuildRepository", ":java-client:generateLicenseReport"