Search in sources :

Example 1 with OpenIndexRequestBuilder

use of org.elasticsearch.action.admin.indices.open.OpenIndexRequestBuilder in project xp by enonic.

the class IndexServiceInternalImpl method openIndices.

@Override
public void openIndices(final String... indices) {
    for (final String indexName : indices) {
        OpenIndexRequestBuilder openIndexRequestBuilder = new OpenIndexRequestBuilder(this.client.admin().indices(), OpenIndexAction.INSTANCE).setIndices(indexName);
        try {
            this.client.admin().indices().open(openIndexRequestBuilder.request()).actionGet();
            LOG.info("Opened index " + indexName);
        } catch (ElasticsearchException e) {
            LOG.error("Could not open index [" + indexName + "]", e);
            throw new IndexException("Cannot open index [" + indexName + "]", e);
        }
    }
}
Also used : IndexException(com.enonic.xp.repository.IndexException) OpenIndexRequestBuilder(org.elasticsearch.action.admin.indices.open.OpenIndexRequestBuilder) ElasticsearchException(org.elasticsearch.ElasticsearchException)

Aggregations

IndexException (com.enonic.xp.repository.IndexException)1 ElasticsearchException (org.elasticsearch.ElasticsearchException)1 OpenIndexRequestBuilder (org.elasticsearch.action.admin.indices.open.OpenIndexRequestBuilder)1