How To delete snapshots older than 20 days

Hi,

I am looking for any API for deleting the snapshots older than 20 days. Right now DELETE api doing deletion only for particular snapshot given with the name.
Please help me.
Thank you.

Regards,
Nagma P.

There is a feature coming in 7.4: https://www.elastic.co/guide/en/elasticsearch/reference/7.x/snapshot-lifecycle-management-api.html

That might be the way to manage that.

Otherwise, I guess you need to explicitly give a snapshot name which contains a date like snap-2019-08-11 and do a script which tries to remove the oldest one (based on their names).

Thanks for the reply.
So there is no way to handle it from ES with current version of elastic search?

From elasticsearch? No.
With curator, may be. :slight_smile: https://www.elastic.co/guide/en/elasticsearch/client/curator/current/delete_snapshots.html

i cant use curator. The deletion should run like job from java scheduler

You need to wait for 7.4 I guess.
Note that I don't know under which license this feature will be available.

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