Add Drop Index to ops (#22614)

This commit is contained in:
Mohit Yadav 2025-07-29 11:41:41 +05:30 committed by GitHub
parent 89bfc6317f
commit ea1e878f10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -146,7 +146,7 @@ public class OpenMetadataOperations implements Callable<Integer> {
LOG.info(
"Subcommand needed: 'info', 'validate', 'repair', 'check-connection', "
+ "'drop-create', 'changelog', 'migrate', 'migrate-secrets', 'reindex', 'deploy-pipelines', "
+ "'dbServiceCleanup', 'relationshipCleanup'");
+ "'dbServiceCleanup', 'relationshipCleanup', 'drop-indexes'");
LOG.info(
"Use 'reindex --auto-tune' for automatic performance optimization based on cluster capabilities");
return 0;
@ -1316,6 +1316,23 @@ public class OpenMetadataOperations implements Callable<Integer> {
}
}
@Command(name = "drop-indexes", description = "Drop all indexes from Elasticsearch/OpenSearch.")
public Integer dropIndexes() {
try {
LOG.info("Dropping all indexes from search engine...");
parseConfig();
for (String entityType : searchRepository.getEntityIndexMap().keySet()) {
LOG.info("Dropping index for entity type: {}", entityType);
searchRepository.deleteIndex(searchRepository.getIndexMapping(entityType));
}
LOG.info("All indexes dropped successfully.");
return 0;
} catch (Exception e) {
LOG.error("Failed to drop indexes due to ", e);
return 1;
}
}
@Command(
name = "analyze-tables",
description =