diff --git a/src/main/java/org/opensearch/sdk/SDKClient.java b/src/main/java/org/opensearch/sdk/SDKClient.java index 6763cdf4..f78046ad 100644 --- a/src/main/java/org/opensearch/sdk/SDKClient.java +++ b/src/main/java/org/opensearch/sdk/SDKClient.java @@ -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. */ diff --git a/src/test/java/org/opensearch/sdk/TestSDKClient.java b/src/test/java/org/opensearch/sdk/TestSDKClient.java index fa308328..22fa03f7 100644 --- a/src/test/java/org/opensearch/sdk/TestSDKClient.java +++ b/src/test/java/org/opensearch/sdk/TestSDKClient.java @@ -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(); }