Skip to content

Commit

Permalink
Add admin method returning the underlying SDKClient
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <[email protected]>
  • Loading branch information
dbwiddis committed Jan 28, 2023
1 parent 01b02e5 commit 7546ee6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/org/opensearch/sdk/SDKClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ public SDKRestClient(RestHighLevelClient restHighLevelClient) {
this.restHighLevelClient = restHighLevelClient;
}

/**
* The admin client that can be used to perform administrative operations.
*/
public SDKRestClient admin() {
return this;
}

/**
* A client allowing to perform actions/operations against the cluster.
*/
Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/opensearch/sdk/TestSDKClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public void testCreateRestClient() throws Exception {
SDKRestClient restClient = sdkClient.initializeRestClient("localhost", 9200);
assertInstanceOf(SDKIndicesClient.class, restClient.indices());
assertInstanceOf(SDKClusterAdminClient.class, restClient.cluster());
assertEquals(restClient, restClient.admin());

sdkClient.doCloseHighLevelClient();
}
Expand Down

0 comments on commit 7546ee6

Please sign in to comment.