use of co.elastic.clients.elasticsearch.core.DeleteResponse in project syncope by apache.
the class ElasticsearchIndexManager method after.
@TransactionalEventListener
public void after(final AnyDeletedEvent event) throws IOException {
LOG.debug("About to delete index for {}[{}]", event.getAnyTypeKind(), event.getAnyKey());
DeleteRequest request = new DeleteRequest.Builder().index(ElasticsearchUtils.getContextDomainName(AuthContextUtils.getDomain(), event.getAnyTypeKind())).id(event.getAnyKey()).build();
DeleteResponse response = client.delete(request);
LOG.debug("Index successfully deleted for {}[{}]: {}", event.getAnyTypeKind(), event.getAnyKey(), response);
}
use of co.elastic.clients.elasticsearch.core.DeleteResponse in project core-ng-project by neowu.
the class ElasticSearchTypeImpl method delete.
@Override
public boolean delete(DeleteRequest request) {
var watch = new StopWatch();
String index = request.index == null ? this.index : request.index;
boolean deleted = false;
try {
DeleteResponse response = elasticSearch.client.delete(builder -> builder.index(index).id(request.id));
deleted = response.result() == Result.Deleted;
return deleted;
} catch (IOException e) {
throw new UncheckedIOException(e);
} catch (ElasticsearchException e) {
throw elasticSearch.searchException(e);
} finally {
long elapsed = watch.elapsed();
ActionLogContext.track("elasticsearch", elapsed, 0, deleted ? 1 : 0);
logger.debug("delete, index={}, id={}, elapsed={}", index, request.id, elapsed);
checkSlowOperation(elapsed);
}
}
Aggregations