Automatically remove older indexes from alias

I have an elastic search alias named "enrich" and it is defined in index template. How can I remove indices older than 15 days from "enrich" alias automatically?

I am aware of below command but this is manual and I am looking for an automatic solution.
POST /_aliases
{
"actions" : [
{ "remove" : { "index" : "test1", "alias" : "enrich" } }
]
}

thanks for helping.

I don't think there's a solution out of the box. But if you're naming your indices correctly (with a timestamp for example) that should not be hard for you to write a script which does that.

That being said maybe you can do something with ILM when moving from a hot/warm tier/phase to a cold tier/phase....

1 Like

thanks for the info. I have to keep the index in hot-warm phase and cant move to cold phase . However I will look into the script option to remove index from alias as suggested.

thanks for the help...

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.