Search in sources :

Example 1 with CreateIndexResponse

use of co.elastic.clients.elasticsearch.indices.CreateIndexResponse in project syncope by apache.

the class ElasticsearchIndexManager method createIndex.

public void createIndex(final String domain, final AnyTypeKind kind, final IndexSettings settings, final TypeMapping mappings) throws IOException {
    try {
        CreateIndexResponse response = doCreateIndex(domain, kind, settings, mappings);
        LOG.debug("Successfully created {} for {}: {}", ElasticsearchUtils.getContextDomainName(domain, kind), kind.name(), response);
    } catch (ElasticsearchException e) {
        LOG.debug("Could not create index {} because it already exists", ElasticsearchUtils.getContextDomainName(domain, kind), e);
        removeIndex(domain, kind);
        doCreateIndex(domain, kind, settings, mappings);
    }
}
Also used : ElasticsearchException(co.elastic.clients.elasticsearch._types.ElasticsearchException) CreateIndexResponse(co.elastic.clients.elasticsearch.indices.CreateIndexResponse)

Aggregations

ElasticsearchException (co.elastic.clients.elasticsearch._types.ElasticsearchException)1 CreateIndexResponse (co.elastic.clients.elasticsearch.indices.CreateIndexResponse)1