Search in sources :

Example 1 with AdminClient

use of org.elasticsearch.client.AdminClient in project play2-elasticsearch by cleverage.

the class IndexService method existsIndex.

/**
     * Test if an indice Exists
     * @return true if exists
     */
public static boolean existsIndex(String indexName) {
    Client client = IndexClient.client;
    AdminClient admin = client.admin();
    IndicesAdminClient indices = admin.indices();
    IndicesExistsRequestBuilder indicesExistsRequestBuilder = indices.prepareExists(indexName);
    IndicesExistsResponse response = indicesExistsRequestBuilder.execute().actionGet();
    return response.isExists();
}
Also used : IndicesExistsRequestBuilder(org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder) IndicesExistsResponse(org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse) IndicesAdminClient(org.elasticsearch.client.IndicesAdminClient) Client(org.elasticsearch.client.Client) IndicesAdminClient(org.elasticsearch.client.IndicesAdminClient) AdminClient(org.elasticsearch.client.AdminClient) IndicesAdminClient(org.elasticsearch.client.IndicesAdminClient) AdminClient(org.elasticsearch.client.AdminClient)

Aggregations

IndicesExistsRequestBuilder (org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder)1 IndicesExistsResponse (org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse)1 AdminClient (org.elasticsearch.client.AdminClient)1 Client (org.elasticsearch.client.Client)1 IndicesAdminClient (org.elasticsearch.client.IndicesAdminClient)1