Search in sources :

Example 11 with IndicesAdminClient

use of org.elasticsearch.client.IndicesAdminClient in project fess by codelibs.

the class AdminUpgradeAction method upgradeFromAll.

private void upgradeFromAll() {
    final IndicesAdminClient indicesClient = fessEsClient.admin().indices();
    final String crawlerIndex = fessConfig.getIndexDocumentCrawlerIndex();
    // .crawler
    if (existsIndex(indicesClient, crawlerIndex, IndicesOptions.fromOptions(false, true, true, true))) {
        deleteIndex(indicesClient, crawlerIndex, response -> {
        });
    }
}
Also used : IndicesAdminClient(org.elasticsearch.client.IndicesAdminClient)

Example 12 with IndicesAdminClient

use of org.elasticsearch.client.IndicesAdminClient 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

IndicesAdminClient (org.elasticsearch.client.IndicesAdminClient)12 Test (org.junit.Test)5 IndicesExistsResponse (org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse)3 DeleteIndexTemplateResponse (org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse)3 GetIndexTemplatesResponse (org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse)3 IndexTemplateMetaData (org.elasticsearch.cluster.metadata.IndexTemplateMetaData)3 UsingDataSet (com.lordofthejars.nosqlunit.annotation.UsingDataSet)2 IndicesAliasesRequest (org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest)2 IndicesAliasesResponse (org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse)2 GetMappingsResponse (org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse)2 DeleteIndexTemplateRequest (org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest)2 AdminClient (org.elasticsearch.client.AdminClient)2 IndexMapping (org.graylog2.indexer.IndexMapping)2 MetricRegistry (com.codahale.metrics.MetricRegistry)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ReadContext (com.jayway.jsonpath.ReadContext)1 List (java.util.List)1 Map (java.util.Map)1