How can we delete an index based on a scheduler using JAVA API's?

Can anyone help me with a java code that can delete index based on a schedule?

Hi @yash_196 Welcome to the community.

Have you perhaps considered Index Lifecycle Management which can do this automatically and is already a built in feature?

Hi @stephenb , thanks for the answer, ILM is a good solution for it. I have one more query: Is there any way to delete data within an index based on some search pattern/query which can be scheduled to run for a time period?

ILM is not query based it is time based.

You would have to look up delete by query which is not a extremely efficient method and you would have to schedule it yourself.

is there any other way to delete based on a schedule? Is Watcher API helpful for these scenarios? To trigger based on a schedule and delete data from an index?

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