From 6a0853ac1fb819ef3bd2a0ed81e6b31c5cc469a9 Mon Sep 17 00:00:00 2001 From: zane-neo Date: Tue, 6 Aug 2024 14:59:40 +0800 Subject: [PATCH] Fix delete local model twice quickly get 500 response issue Signed-off-by: zane-neo --- .../opensearch/ml/action/models/DeleteModelTransportAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/src/main/java/org/opensearch/ml/action/models/DeleteModelTransportAction.java b/plugin/src/main/java/org/opensearch/ml/action/models/DeleteModelTransportAction.java index 7d18fe18d1..055d5556d1 100644 --- a/plugin/src/main/java/org/opensearch/ml/action/models/DeleteModelTransportAction.java +++ b/plugin/src/main/java/org/opensearch/ml/action/models/DeleteModelTransportAction.java @@ -185,7 +185,7 @@ protected void doExecute(Task task, ActionRequest request, ActionListener actionListener) { DeleteByQueryRequest deleteModelsRequest = new DeleteByQueryRequest(ML_MODEL_INDEX); - deleteModelsRequest.setQuery(new TermsQueryBuilder(MODEL_ID_FIELD, modelId)); + deleteModelsRequest.setQuery(new TermsQueryBuilder(MODEL_ID_FIELD, modelId)).setRefresh(true); client.execute(DeleteByQueryAction.INSTANCE, deleteModelsRequest, ActionListener.wrap(r -> { if ((r.getBulkFailures() == null || r.getBulkFailures().size() == 0)