use of org.elasticsearch.action.deletebyquery.DeleteByQueryResponse in project bw-calendar-engine by Bedework.
the class BwIndexEsImpl method deleteEvent.
private boolean deleteEvent(final String href) throws CalFacadeException {
final DeleteByQueryRequestBuilder delQreq = getClient().prepareDeleteByQuery(targetIndex).setTypes(docTypeEvent, docTypePoll);
final ESQueryFilter esq = getFilters(null);
final FilterBuilder fb = esq.addTerm(PropertyInfoIndex.HREF, href);
delQreq.setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), fb));
final DeleteByQueryResponse delResp = delQreq.execute().actionGet();
boolean ok = true;
for (final IndexDeleteByQueryResponse idqr : delResp.getIndices().values()) {
if (idqr.getFailedShards() > 0) {
warn("Failing shards for delete href: " + href + " index: " + idqr.getIndex());
ok = false;
}
}
return ok;
}
Aggregations