use of org.opensearch.client.opensearch.indices.GetIndexResponse in project opensearch-java by opensearch-project.
the class IndicesClientIT method testCreateIndex.
public void testCreateIndex() throws Exception {
OpenSearchAsyncClient asyncClient = new OpenSearchAsyncClient(highLevelClient()._transport());
CreateIndexResponse createResponse = highLevelClient().indices().create(b -> b.index("my-index"));
assertTrue(createResponse.acknowledged());
assertTrue(createResponse.shardsAcknowledged());
// Find info about it, using the async client
CompletableFuture<GetIndexResponse> futureResponse = asyncClient.indices().get(b -> b.index("my-index"));
GetIndexResponse response = futureResponse.get(10, TimeUnit.SECONDS);
Map<String, IndexState> indices = response.result();
assertEquals(1, indices.size());
assertNotNull(indices.get("my-index"));
}
use of org.opensearch.client.opensearch.indices.GetIndexResponse in project opensearch-java by opensearch-project.
the class RequestTest method testIndexCreation.
@Test
public void testIndexCreation() throws Exception {
OpenSearchAsyncClient asyncClient = new OpenSearchAsyncClient(highLevelClient()._transport());
// Ping the server
assertTrue(highLevelClient().ping().value());
// Create an index...
final CreateIndexResponse createResponse = highLevelClient().indices().create(b -> b.index("my-index"));
assertTrue(createResponse.acknowledged());
assertTrue(createResponse.shardsAcknowledged());
// Find info about it, using the async client
CompletableFuture<GetIndexResponse> futureResponse = asyncClient.indices().get(b -> b.index("my-index"));
GetIndexResponse response = futureResponse.get(10, TimeUnit.SECONDS);
Map<String, IndexState> indices = response.result();
assertEquals(1, indices.size());
assertNotNull(indices.get("my-index"));
}
Aggregations