Number of snapshots stored/retained in a repository

Dear Forum,

We are currently running Elasticsearch 1.5.2 which we attempt to back up every midnight by issuing a createSnapshot API call to a shared file system repo backup. What puzzles us is that in our QA and production environment we only see the three or four latest snapshots being retained in the repository, while in our development environment and on local computers we tend to see a much higher number of snapshots being kept in the repo. We believe that QA and production also should show an ever increasing number of available snapshots and not be limited to three or four.

As far as I have been able to find out, Elasticsearch does not implement or offer any configuration of retention policy, number of snapshots to keep, auto delete or the like. I've searched through our code base and there are no usages of deleteSnapshot or deleteRepository that I can find.

Is there something regarding snapshot/restore we're missing or not understanding? Does anyone have an explanation for the behavior we're seeing?


ES will keep things around for as long as it can, it's up to you to delete.

Try checking your logs for mentions of the deletes.

Ha, no wonder we were missing snapshots. Somewhere along the line, on the production servers where we (the devs) have no visibility, someone cleverly added a cron job which deletes all backup files older than 3 days. Which doesn't work very well with the snapshot/restore feature knowing how it actually writes files to disk.

Thanks for replying and triggering us to look deeper.

Ouch :frowning:
Glad you found it though.