use of org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest in project sonarqube by SonarSource.
the class EsTester method deleteIndexIfExists.
private static void deleteIndexIfExists(String name) {
try {
AcknowledgedResponse response = ES_REST_CLIENT.nativeClient().indices().delete(new DeleteIndexRequest(name), RequestOptions.DEFAULT);
checkState(response.isAcknowledged(), "Fail to drop the index " + name);
} catch (ElasticsearchStatusException e) {
if (e.status().getStatus() == 404) {
// ignore, index not found
} else {
throw e;
}
} catch (IOException e) {
throw new IllegalStateException("Could not delete index", e);
}
}
use of org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest in project elasticsearch-skywalker by jprante.
the class AbstractNodeTest method deleteIndices.
@AfterMethod
public void deleteIndices() {
try {
// clear test index
client("1").admin().indices().delete(new DeleteIndexRequest().indices(INDEX)).actionGet();
} catch (IndexMissingException e) {
// ignore
}
closeNode("1");
closeAllNodes();
}
use of org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest in project pancm_project by xuwujing.
the class EsHighLevelRestTest1 method deleteIndex.
/**
* 删除索引
*
* @throws IOException
*/
private static void deleteIndex() throws IOException {
String index = "userindex";
DeleteIndexRequest request = new DeleteIndexRequest(index);
// 同步删除
client.indices().delete(request, RequestOptions.DEFAULT);
System.out.println("删除索引库成功!" + index);
}
use of org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest in project crate by crate.
the class AlterTableOperation method deleteIndex.
private CompletableFuture<Long> deleteIndex(String... indexNames) {
DeleteIndexRequest request = new DeleteIndexRequest(indexNames);
FutureActionListener<AcknowledgedResponse, Long> listener = new FutureActionListener<>(r -> 0L);
transportDeleteIndexAction.execute(request, listener);
return listener;
}
use of org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest in project crate by crate.
the class DeleteAllPartitions method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier executor, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
if (partitions.isEmpty()) {
consumer.accept(InMemoryBatchIterator.of(new Row1(0L), SentinelRow.SENTINEL), null);
} else {
/*
* table is partitioned, in case of concurrent "delete from partitions"
* it could be that some partitions are already deleted,
* so ignore it if some are missing
*/
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(partitions().toArray(new String[0])).indicesOptions(IndicesOptions.lenientExpandOpen());
executor.transportActionProvider().transportDeleteIndexAction().execute(deleteIndexRequest, new OneRowActionListener<>(consumer, r -> Row1.ROW_COUNT_UNKNOWN));
}
}
Aggregations