mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-26 17:34:41 +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) {
|
for (String entityType : entities) {
|
||||||
if (Boolean.FALSE.equals(jobData.getRecreateIndex())) {
|
if (Boolean.FALSE.equals(jobData.getRecreateIndex())) {
|
||||||
LOG.debug("RecreateIndex is false. Skipping index recreation for '{}'.", entityType);
|
LOG.debug("RecreateIndex is false. Skipping index recreation for '{}'.", entityType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
IndexMapping indexType = searchRepository.getIndexMapping(entityType);
|
||||||
// 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);
|
|
||||||
if (indexType == null) {
|
if (indexType == null) {
|
||||||
LOG.warn(
|
LOG.warn(
|
||||||
"No index mapping found for entityType '{}'. Skipping index recreation.",
|
"No index mapping found for entityType '{}'. Skipping index recreation.", entityType);
|
||||||
correctedEntityType);
|
continue;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
searchRepository.deleteIndex(indexType);
|
searchRepository.deleteIndex(indexType);
|
||||||
searchRepository.createIndex(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