# Auto Delete old indices based on size (on hitting the low watermark setting)

**URL:** <https://discuss.elastic.co/t/auto-delete-old-indices-based-on-size-on-hitting-the-low-watermark-setting/275353>\
**Category:** Elasticsearch\
**Created:** [June 8, 2021, 10:01pm UTC](https://discuss.elastic.co/t/auto-delete-old-indices-based-on-size-on-hitting-the-low-watermark-setting/275353 "2021-06-08T22:01:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rakeshr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakeshr/32/19457_2.png) [@rakeshr](https://discuss.elastic.co/u/rakeshr)\
**Post date:** [June 8, 2021, 10:01pm UTC](https://discuss.elastic.co/t/auto-delete-old-indices-based-on-size-on-hitting-the-low-watermark-setting/275353/1 "2021-06-08T22:01:29Z")

</div>

Hi,

Is there any setting which would auto Delete old indices on hitting the lower watermark setting? I could not find much information from the documentation regarding such a setting.  
If not, how can this be done ?

---

<div class="post-metadata">

**Author:** ![AClerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aclerk/32/55297_2.png) [@AClerk](https://discuss.elastic.co/u/AClerk)\
**Post date:** [June 9, 2021, 1:38am UTC](https://discuss.elastic.co/t/auto-delete-old-indices-based-on-size-on-hitting-the-low-watermark-setting/275353/2 "2021-06-09T01:38:46Z")

</div>

> [@rakeshr](#):
>
> the lower watermark setting?

What is that?

AFAIK, You cannot delete based on size. Logically it does not make any sense.  
As you say `old` that means you refer to age/date created.

Cheers 🧸

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 9, 2021, 2:04am UTC](https://discuss.elastic.co/t/auto-delete-old-indices-based-on-size-on-hitting-the-low-watermark-setting/275353/3 "2021-06-09T02:04:46Z")

</div>

It is not possible, to automatically delete indices you would use a Index Lifecycle policy, but these policies only support `age` as a the parameter in the delete phase.

If you want to delete indices when your cluster reach the low watermark you would need to monitor your elasticsearch logs to see when it was reached and then trigger a request to delete some indice, but you would need to write this logic using an external tool and you would need to specify what index you want to delete.

It is best to set the deleta phase to delete indices after some time to avoid reaching the low watermark phase in your cluster

---

<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 7, 2021, 2:05am UTC](https://discuss.elastic.co/t/auto-delete-old-indices-based-on-size-on-hitting-the-low-watermark-setting/275353/4 "2021-07-07T02:05:34Z")

</div>

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