diff --git a/core/app/datasource/src/main/java/io/openk9/datasource/service/DataIndexService.java b/core/app/datasource/src/main/java/io/openk9/datasource/service/DataIndexService.java index 3db54ca96..dba7a30b5 100644 --- a/core/app/datasource/src/main/java/io/openk9/datasource/service/DataIndexService.java +++ b/core/app/datasource/src/main/java/io/openk9/datasource/service/DataIndexService.java @@ -33,6 +33,7 @@ import io.openk9.datasource.service.util.Tuple2; import io.smallrye.mutiny.Uni; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; +import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RestHighLevelClient; @@ -40,6 +41,7 @@ import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import java.io.IOException; +import java.util.Map; import java.util.Set; @ApplicationScoped @@ -155,8 +157,18 @@ public Uni deleteById(long entityId) { .onItem() .transformToUni(dataIndex -> Uni.createFrom() .emitter(emitter -> { + DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(dataIndex.getName()); + + deleteIndexRequest + .indicesOptions( + IndicesOptions.fromMap( + Map.of("ignore_unavailable", true), + deleteIndexRequest.indicesOptions() + ) + ); + try { AcknowledgedResponse delete = client.indices().delete( deleteIndexRequest,