Skip to content

Commit

Permalink
[eem] fix delete indices (#189996)
Browse files Browse the repository at this point in the history
resolve index fails when latest index does not exist and we only need
one call to delete indices api anyway
  • Loading branch information
klacabane authored Aug 7, 2024
1 parent 514db54 commit beef9ba
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ export async function deleteIndices(
logger: Logger
) {
try {
const response = await esClient.indices.resolveIndex({
name: `${generateHistoryIndexName(definition)}.*,${generateLatestIndexName(definition)}`,
});
const indices = response.indices.map((doc) => doc.name);
if (indices.length) {
await esClient.indices.delete({ index: indices, ignore_unavailable: true });
}
const indices = [
`${generateHistoryIndexName(definition)}.*`,
generateLatestIndexName(definition),
];
await esClient.indices.delete({ index: indices, ignore_unavailable: true });
} catch (e) {
logger.error(`Unable to remove entity definition index [${definition.id}}]`);
throw e;
Expand Down

0 comments on commit beef9ba

Please sign in to comment.