# Can Rollover API / ILM be used to keep only x days data in an index at any point of time

**URL:** <https://discuss.elastic.co/t/can-rollover-api-ilm-be-used-to-keep-only-x-days-data-in-an-index-at-any-point-of-time/341410>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [August 22, 2023, 7:47pm UTC](https://discuss.elastic.co/t/can-rollover-api-ilm-be-used-to-keep-only-x-days-data-in-an-index-at-any-point-of-time/341410 "2023-08-22T19:47:34Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Aditya1996](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Aditya1996](https://discuss.elastic.co/u/Aditya1996)\
**Post date:** [August 23, 2023, 3:51pm UTC](https://discuss.elastic.co/t/can-rollover-api-ilm-be-used-to-keep-only-x-days-data-in-an-index-at-any-point-of-time/341410/3 "2023-08-23T15:51:03Z")

</div>

But usually delete by query isn't looked upon as an efficient solution.  
@theuntergeek mentioned in the post [What is the definitive way of only retaining 7 days of logs](https://discuss.elastic.co/t/what-is-the-definitive-way-of-only-retaining-7-days-of-logs/28399).

---

_[View the full topic](https://discuss.elastic.co/t/can-rollover-api-ilm-be-used-to-keep-only-x-days-data-in-an-index-at-any-point-of-time/341410)._
