Skip to content

Commit

Permalink
Update Readme and Bump Version
Browse files Browse the repository at this point in the history
Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
  • Loading branch information
imRishN committed Feb 16, 2022
1 parent 62e6ee4 commit c4f674c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ 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/).


**Note: This project is in beta stage and is for testing and feedback purposes only.**
## Project Resources

* [Project Website](https://opensearch.org/)
* [Downloads](https://opensearch.org/downloads.html).
* [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)
Expand Down Expand Up @@ -52,29 +51,29 @@ try (RestClient restClient = RestClient.builder(new HttpHost("localhost", 9200))
String index = "test-index";

// Create Client
Transport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());
OpenSearchTransport 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();
CreateIndexRequest createIndexRequest = new CreateIndexRequest.Builder().index(index).build();
CreateIndexResponse createIndexResponse = client.indices().create(createIndexRequest);
assert createIndexResponse.shardsAcknowledged();

// Index Document
IndexData indexData = new IndexData("foo", "bar");
IndexRequest<IndexData> indexRequest = new IndexRequest.Builder<IndexData>().index(index).id("1").value(indexData).build();
AppData appData = new AppData(1337, "foo");

IndexRequest<AppData> indexRequest = new IndexRequest.Builder<AppData>().index("index").id("1").document(appData).build();
IndexResponse indexResponse = client.index(indexRequest);
assert Objects.equals(indexResponse.id(), "1");
assertEquals(Result.Created, indexResponse.result());

// Search Documents
SearchResponse<IndexData> 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);
SearchResponse<AppData> search = client.search(b -> b.index(index), AppData.class);
assertEquals(1, search.hits().total().value());

// Delete Index
DeleteRequest deleteRequest = new DeleteRequest.Builder().index(index).build();
DeleteResponse deleteResponse = client.indices().delete(deleteRequest);
assert deleteResponse.acknowledged();
DeleteIndexRequest deleteRequest = new DeleteIndexRequest.Builder().index(index).build();
DeleteIndexResponse deleteResponse = client.indices().delete(deleteRequest);
assert deleteResponse.shardsAcknowledged();
}
```

Expand Down
2 changes: 1 addition & 1 deletion config/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.1
1.0.0
11 changes: 11 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/usr/bin/env sh

#
# 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
Expand Down Expand Up @@ -35,6 +42,10 @@
# limitations under the License.
#

# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.


##############################################################################
##
## Gradle start up script for UN*X
Expand Down
2 changes: 1 addition & 1 deletion java-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ publishing {
name.set("OpenSearch Java Client")
packaging = "jar"
artifactId = "opensearch-java"
description.set("High level OpenSearch Java Client. This is a pre-release of 1.0.0 and is for testing and feedback purposes only.")
description.set("High level OpenSearch Java Client.")
url.set("https://github.com/opensearch-project/opensearch-java/")
scm {
connection.set("scm:git@github.com:opensearch-project/opensearch-java.git")
Expand Down

0 comments on commit c4f674c

Please sign in to comment.