in core/src/main/java/org/apache/sdap/mudrod/driver/ESDriver.java [188:228]
public void deleteAllByQuery(String index, String type, QueryBuilder query) {
ImmutableOpenMap<String, MappingMetaData> mappings = getClient()
.admin()
.cluster()
.prepareState()
.execute()
.actionGet()
.getState()
.metaData()
.index(index)
.getMappings();
//check if the type exists
if (!mappings.containsKey(type))
return;
createBulkProcessor();
SearchResponse scrollResp = getClient()
.prepareSearch(index)
.setSearchType(SearchType.QUERY_AND_FETCH)
.setTypes(type)
.setScroll(new TimeValue(60000))
.setQuery(query)
.setSize(10000)
.execute()
.actionGet();
while (true) {
for (SearchHit hit : scrollResp.getHits().getHits()) {
DeleteRequest deleteRequest = new DeleteRequest(index, type, hit.getId());
getBulkProcessor().add(deleteRequest);
}
scrollResp = getClient().prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(600000)).execute().actionGet();
if (scrollResp.getHits().getHits().length == 0) {
break;
}
}
destroyBulkProcessor();
}