[ML] Ignore IndexNotFoundException when deleting quantiles (elastic/x-pack-elasticsearch#1507)

Relates elastic/elasticsearch#24518

Original commit: elastic/x-pack-elasticsearch@34ee52443c
This commit is contained in:
David Roberts 2017-05-22 11:04:27 +01:00 committed by GitHub
parent 527dcfd98d
commit 5b2ef6e98e
1 changed files with 10 additions and 1 deletions

View File

@ -109,7 +109,16 @@ public class JobStorageDeletionTask extends Task {
private void deleteQuantiles(String jobId, Client client, ActionListener<DeleteResponse> finishedHandler) { private void deleteQuantiles(String jobId, Client client, ActionListener<DeleteResponse> finishedHandler) {
client.prepareDelete(AnomalyDetectorsIndex.jobStateIndexName(), Quantiles.TYPE.getPreferredName(), Quantiles.documentId(jobId)) client.prepareDelete(AnomalyDetectorsIndex.jobStateIndexName(), Quantiles.TYPE.getPreferredName(), Quantiles.documentId(jobId))
.execute(finishedHandler); .execute(ActionListener.wrap(
finishedHandler::onResponse,
e -> {
// It's not a problem for us if the index wasn't found - it's equivalent to document not found
if (e instanceof IndexNotFoundException) {
finishedHandler.onResponse(new DeleteResponse());
} else {
finishedHandler.onFailure(e);
}
}));
} }
private void deleteModelState(String jobId, Client client, ActionListener<BulkResponse> listener) { private void deleteModelState(String jobId, Client client, ActionListener<BulkResponse> listener) {