# Number of snapshots stored/retained in a repository

**URL:** <https://discuss.elastic.co/t/number-of-snapshots-stored-retained-in-a-repository/27511>\
**Category:** Elasticsearch\
**Created:** [August 17, 2015, 2:28pm UTC](https://discuss.elastic.co/t/number-of-snapshots-stored-retained-in-a-repository/27511 "2015-08-17T14:28:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![janwe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/janwe/32/4221_2.png) [@janwe](https://discuss.elastic.co/u/janwe)\
**Post date:** [August 17, 2015, 2:28pm UTC](https://discuss.elastic.co/t/number-of-snapshots-stored-retained-in-a-repository/27511/1 "2015-08-17T14:28:12Z")

</div>

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?

Thanks.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 17, 2015, 10:32pm UTC](https://discuss.elastic.co/t/number-of-snapshots-stored-retained-in-a-repository/27511/2 "2015-08-17T22:32:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![janwe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/janwe/32/4221_2.png) [@janwe](https://discuss.elastic.co/u/janwe)\
**Post date:** [August 19, 2015, 7:44am UTC](https://discuss.elastic.co/t/number-of-snapshots-stored-retained-in-a-repository/27511/3 "2015-08-19T07:44:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 21, 2015, 9:36am UTC](https://discuss.elastic.co/t/number-of-snapshots-stored-retained-in-a-repository/27511/4 "2015-08-21T09:36:27Z")

</div>

Ouch ☹  
Glad you found it though.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:54pm UTC](https://discuss.elastic.co/t/number-of-snapshots-stored-retained-in-a-repository/27511/5 "2017-07-05T23:54:40Z")

</div>


