use of co.elastic.clients.elasticsearch.indices.GetIndexResponse in project elasticsearch-java by elastic.
the class RequestTest method testIndexCreation.
@Test
public void testIndexCreation() throws Exception {
ElasticsearchAsyncClient asyncClient = new ElasticsearchAsyncClient(client._transport());
// Ping the server
assertTrue(client.ping().value());
// Create an index...
final CreateIndexResponse createResponse = client.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