# Monthly indices but ILM on daily basis

**URL:** <https://discuss.elastic.co/t/monthly-indices-but-ilm-on-daily-basis/293458>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [January 4, 2022, 2:52pm UTC](https://discuss.elastic.co/t/monthly-indices-but-ilm-on-daily-basis/293458 "2022-01-04T14:52:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![windows95](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@windows95](https://discuss.elastic.co/u/windows95)\
**Post date:** [January 4, 2022, 2:52pm UTC](https://discuss.elastic.co/t/monthly-indices-but-ilm-on-daily-basis/293458/1 "2022-01-04T14:52:25Z")

</div>

Hello.

I had daily indices and a fixed retention time of 365 days via ILM. Now I changed to monthly indices to increase the index size. The problem now is that when the oldest index will be deleted, all data from now-(365-30) will be deleted. What is a good way to get around this? Summarized: I want an exact retention time of 365 days. Not more and not less. A naive idea is to reindex indices that become 11 months old into "daily" indices but I hope there are better ways.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 4, 2022, 3:28pm UTC](https://discuss.elastic.co/t/monthly-indices-but-ilm-on-daily-basis/293458/2 "2022-01-04T15:28:25Z")

</div>

ILM deletes complete indices so if you have monthly indices that is the deletion granularity. ILM therefore never allows exact retention. By changing to daily indices you can get more accurate but data will still only be deleted once per day.

---

<div class="post-metadata">

**Author:** ![windows95](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@windows95](https://discuss.elastic.co/u/windows95)\
**Post date:** [January 4, 2022, 10:48pm UTC](https://discuss.elastic.co/t/monthly-indices-but-ilm-on-daily-basis/293458/3 "2022-01-04T22:48:44Z")

</div>

I know. That's why I am seeking for a workaround. I just stumbled upon Delete API and Delete by query API. Until now I thought it is not possible to delete or alter documents from an index without deleting the whole index. I am wondering if they really simply delete documents or if they cause recreation of an index. I think I will do some performance tests with delete operations.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 5, 2022, 7:20am UTC](https://discuss.elastic.co/t/monthly-indices-but-ilm-on-daily-basis/293458/4 "2022-01-05T07:20:07Z")

</div>

Delete by query deletes documents. Deleting documents this way is however much less efficient than simply deleting full indices as each delete in reality is an update with a tombstone record. It therefore results in much higher load and resource usage on the cluster.

---

<div class="post-metadata">

**Author:** ![windows95](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@windows95](https://discuss.elastic.co/u/windows95)\
**Post date:** [January 5, 2022, 7:33am UTC](https://discuss.elastic.co/t/monthly-indices-but-ilm-on-daily-basis/293458/5 "2022-01-05T07:33:50Z")

</div>

Ah ok. So delete is not really delete. Since the main goal behind this is to satisfy data protection regulations, this would not fit my needs.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 5, 2022, 7:56am UTC](https://discuss.elastic.co/t/monthly-indices-but-ilm-on-daily-basis/293458/6 "2022-01-05T07:56:36Z")

</div>

It is a delete, but space is only freed up through merging, which does not happen right away.

---

<div class="post-metadata">

**Author:** ![windows95](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@windows95](https://discuss.elastic.co/u/windows95)\
**Post date:** [January 10, 2022, 9:06pm UTC](https://discuss.elastic.co/t/monthly-indices-but-ilm-on-daily-basis/293458/7 "2022-01-10T21:06:52Z")

</div>

I stick with deleting indices. Thanks for your help. I don't see a close button here so I at least mark a post as solution.

---

<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:** [February 7, 2022, 9:07pm UTC](https://discuss.elastic.co/t/monthly-indices-but-ilm-on-daily-basis/293458/8 "2022-02-07T21:07:04Z")

</div>

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