From 52a8ec0489c24ae6af43d097fc032f09c706bd74 Mon Sep 17 00:00:00 2001 From: Sriharsha Chintalapani Date: Mon, 30 Jun 2025 17:38:31 -0700 Subject: [PATCH] Fix: recreate fails if we can't find one index for a given entity (#22047) --- .../bundles/searchIndex/SearchIndexApp.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java index 7f4a4f3154b..245fe6f31e5 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java @@ -791,30 +791,21 @@ public class SearchIndexApp extends AbstractNativeApplication { } } - private void reCreateIndexes(Set entities) throws SearchIndexException { + private void reCreateIndexes(Set entities) { for (String entityType : entities) { if (Boolean.FALSE.equals(jobData.getRecreateIndex())) { LOG.debug("RecreateIndex is false. Skipping index recreation for '{}'.", entityType); return; } - - // Handle incorrect entity type name for query cost - String correctedEntityType = entityType; - if ("queryCostResult".equals(entityType)) { - LOG.warn("Found incorrect entity type 'queryCostResult', correcting to 'queryCostRecord'"); - correctedEntityType = QUERY_COST_RECORD; - } - - IndexMapping indexType = searchRepository.getIndexMapping(correctedEntityType); + IndexMapping indexType = searchRepository.getIndexMapping(entityType); if (indexType == null) { LOG.warn( - "No index mapping found for entityType '{}'. Skipping index recreation.", - correctedEntityType); - return; + "No index mapping found for entityType '{}'. Skipping index recreation.", entityType); + continue; } searchRepository.deleteIndex(indexType); searchRepository.createIndex(indexType); - LOG.info("Recreated index for entityType '{}'.", correctedEntityType); + LOG.info("Recreated index for entityType '{}'.", entityType); } }