use of org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder in project molgenis by molgenis.
the class ClientFacade method deleteIndexes.
private void deleteIndexes(List<Index> indexes) {
if (LOG.isTraceEnabled()) {
LOG.trace("Deleting index(es) '{}' ...", toString(indexes));
}
String[] indexNames = toIndexNames(indexes);
DeleteIndexRequestBuilder deleteIndexRequest = client.admin().indices().prepareDelete(indexNames);
DeleteIndexResponse deleteIndexResponse;
try {
deleteIndexResponse = deleteIndexRequest.get();
} catch (ResourceNotFoundException e) {
LOG.debug("", e);
throw new UnknownIndexException(toString(indexes));
} catch (ElasticsearchException e) {
LOG.error("", e);
throw new IndexException(format("Error deleting index(es) '%s'.", toString(indexes)));
}
if (!deleteIndexResponse.isAcknowledged()) {
throw new IndexException(format("Error deleting index(es) '%s'.", toString(indexes)));
}
if (LOG.isDebugEnabled()) {
LOG.debug("Deleted index(es) '{}'.", toString(indexes));
}
}
use of org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder in project bw-calendar-engine by Bedework.
the class BwIndexEsImpl method deleteIndexes.
private void deleteIndexes(final List<String> names) throws CalFacadeException {
try {
final IndicesAdminClient idx = getAdminIdx();
final DeleteIndexRequestBuilder dirb = getAdminIdx().prepareDelete(names.toArray(new String[names.size()]));
final ActionFuture<DeleteIndexResponse> dr = idx.delete(dirb.request());
/*DeleteIndexResponse dir = */
dr.actionGet();
} catch (final Throwable t) {
throw new CalFacadeException(t);
}
}
Aggregations