mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-26 09:22:14 +00:00
Fix: recreate fails if we can't find one index for a given entity (#22047)
This commit is contained in:
parent
ccdaa8d132
commit
52a8ec0489
@ -791,30 +791,21 @@ public class SearchIndexApp extends AbstractNativeApplication {
|
||||
}
|
||||
}
|
||||
|
||||
private void reCreateIndexes(Set<String> entities) throws SearchIndexException {
|
||||
private void reCreateIndexes(Set<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user