Search in sources :

Example 11 with DeleteIndexRequest

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest in project graylog2-server by Graylog2.

the class IndicesAdapterES7 method delete.

@Override
public void delete(String index) {
    final DeleteIndexRequest request = new DeleteIndexRequest(index);
    client.execute((c, requestOptions) -> c.indices().delete(request, requestOptions));
}
Also used : DeleteIndexRequest(org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest)

Example 12 with DeleteIndexRequest

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest in project titan by thinkaurelius.

the class ElasticSearchIndex method clearStorage.

@Override
public void clearStorage() throws StorageException {
    try {
        try {
            client.admin().indices().delete(new DeleteIndexRequest(indexName)).actionGet();
            // We wait for one second to let ES delete the river
            Thread.sleep(1000);
        } catch (IndexMissingException e) {
        // Index does not exist... Fine
        }
    } catch (Exception e) {
        throw new PermanentStorageException("Could not delete index " + indexName, e);
    } finally {
        close();
    }
}
Also used : PermanentStorageException(com.thinkaurelius.titan.diskstorage.PermanentStorageException) DeleteIndexRequest(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest) IndexMissingException(org.elasticsearch.indices.IndexMissingException) ElasticSearchInterruptedException(org.elasticsearch.ElasticSearchInterruptedException) PermanentStorageException(com.thinkaurelius.titan.diskstorage.PermanentStorageException) TitanException(com.thinkaurelius.titan.core.TitanException) TemporaryStorageException(com.thinkaurelius.titan.diskstorage.TemporaryStorageException) IndexMissingException(org.elasticsearch.indices.IndexMissingException) StorageException(com.thinkaurelius.titan.diskstorage.StorageException) IOException(java.io.IOException)

Example 13 with DeleteIndexRequest

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest in project snow-owl by b2ihealthcare.

the class EsIndexAdmin method delete.

@Override
public void delete() {
    if (exists()) {
        final DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(name + "*");
        try {
            final AcknowledgedResponse deleteIndexResponse = client().indices().delete(deleteIndexRequest);
            checkState(deleteIndexResponse.isAcknowledged(), "Failed to delete all ES indices for '%s'.", name);
        } catch (Exception e) {
            throw new IndexException(String.format("Failed to delete all ES indices for '%s'.", name), e);
        }
    }
}
Also used : AcknowledgedResponse(org.elasticsearch.action.support.master.AcknowledgedResponse) DeleteIndexRequest(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest) IOException(java.io.IOException)

Example 14 with DeleteIndexRequest

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest in project sonarqube by SonarSource.

the class MigrationEsClientImpl method deleteIndex.

private void deleteIndex(String index) {
    Loggers.get(getClass()).info("Drop Elasticsearch index [{}]", index);
    client.deleteIndex(new DeleteIndexRequest(index));
}
Also used : DeleteIndexRequest(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest)

Example 15 with DeleteIndexRequest

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest in project apex-malhar by apache.

the class ElasticSearchPercolateTest method cleanup.

@After
public void cleanup() throws IOException {
    try {
        DeleteIndexResponse delete = store.client.admin().indices().delete(new DeleteIndexRequest(INDEX_NAME)).actionGet();
        if (!delete.isAcknowledged()) {
            logger.error("Index wasn't deleted");
        }
        store.disconnect();
    } catch (NoNodeAvailableException e) {
    // This indicates that elasticsearch is not running on a particular machine.
    // Silently ignore in this case.
    }
}
Also used : DeleteIndexResponse(org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse) DeleteIndexRequest(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest) NoNodeAvailableException(org.elasticsearch.client.transport.NoNodeAvailableException) After(org.junit.After)

Aggregations

DeleteIndexRequest (org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest)37 IOException (java.io.IOException)15 DeleteIndexResponse (org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse)15 CreateIndexRequest (org.elasticsearch.action.admin.indices.create.CreateIndexRequest)13 IndicesExistsRequest (org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest)12 PutMappingResponse (org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse)9 ArrayList (java.util.ArrayList)6 AcknowledgedResponse (org.elasticsearch.action.support.master.AcknowledgedResponse)6 List (java.util.List)5 Row1 (io.crate.data.Row1)3 OneRowActionListener (io.crate.execution.support.OneRowActionListener)3 BulkRequest (org.elasticsearch.action.bulk.BulkRequest)3 MultiGetRequest (org.elasticsearch.action.get.MultiGetRequest)3 MultiSearchRequest (org.elasticsearch.action.search.MultiSearchRequest)3 SearchRequest (org.elasticsearch.action.search.SearchRequest)3 FutureActionListener (io.crate.action.FutureActionListener)2 Row (io.crate.data.Row)2 RowConsumer (io.crate.data.RowConsumer)2 DependencyCarrier (io.crate.planner.DependencyCarrier)2 Plan (io.crate.planner.Plan)2