# Auto delete index on the basis of index size

**URL:** <https://discuss.elastic.co/t/auto-delete-index-on-the-basis-of-index-size/316186>\
**Category:** Kibana\
**Tags:** ilm-index-lifecycle-management\
**Created:** [October 10, 2022, 7:57am UTC](https://discuss.elastic.co/t/auto-delete-index-on-the-basis-of-index-size/316186 "2022-10-10T07:57:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mangesh\_Mathe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mangesh_mathe/32/103371_2.png) [@Mangesh\_Mathe](https://discuss.elastic.co/u/Mangesh_Mathe)\
**Post date:** [October 10, 2022, 7:57am UTC](https://discuss.elastic.co/t/auto-delete-index-on-the-basis-of-index-size/316186/1 "2022-10-10T07:57:39Z")

</div>

I Want to delete two different production index if it exceeds 50GB size.  
I tried to use ILM policy on the basis of index size, I tried rollover condition with hot phase max\_size 50GB and then delete phase after 1 hour. But its not working.

```auto
PUT _ilm/policy/1-day-delete-policy
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_size": "50gb"
          },
          "set_priority": {
            "priority": 100
          }
        }
},
 "delete": {
        "min_age": "1h",
        "actions": {
        "delete": {
         "delete_searchable_snapshot": true
      }
    }
  }
}
}
}

```

Please suggest.

---

<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:** [October 10, 2022, 9:51pm UTC](https://discuss.elastic.co/t/auto-delete-index-on-the-basis-of-index-size/316186/2 "2022-10-10T21:51:40Z")

</div>

Can you please do an [ILM explain](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) on the index?

---

<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:** [November 7, 2022, 1:43pm UTC](https://discuss.elastic.co/t/auto-delete-index-on-the-basis-of-index-size/316186/3 "2022-11-07T13:43:22Z")

</div>



---

<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:** [December 5, 2022, 10:27am UTC](https://discuss.elastic.co/t/auto-delete-index-on-the-basis-of-index-size/316186/4 "2022-12-05T10:27:04Z")

</div>



---

<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:** [January 2, 2023, 10:27am UTC](https://discuss.elastic.co/t/auto-delete-index-on-the-basis-of-index-size/316186/5 "2023-01-02T10:27:10Z")

</div>

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