# Can I use ILM to switch index\_code to DEFLATE after 40 days ？

**URL:** <https://discuss.elastic.co/t/can-i-use-ilm-to-switch-index-code-to-deflate-after-40-days/358272>\
**Category:** Elastic Search\
**Created:** [April 26, 2024, 7:45am UTC](https://discuss.elastic.co/t/can-i-use-ilm-to-switch-index-code-to-deflate-after-40-days/358272 "2024-04-26T07:45:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wangsubo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wangsubo/32/133865_2.png) [@wangsubo](https://discuss.elastic.co/u/wangsubo)\
**Post date:** [April 26, 2024, 7:45am UTC](https://discuss.elastic.co/t/can-i-use-ilm-to-switch-index-code-to-deflate-after-40-days/358272/1 "2024-04-26T07:45:46Z")

</div>

Within 40 days, I plan to utilize LZ4 for fast compression and decompression - Hot Node.

After exceeding 40 days, switching to DEFLATE (high compression ratio) can effectively reduce storage space - Warm Node.

Can Index Lifecycle Management be used to change index\_code to DEFLATE?

---

<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:** [April 26, 2024, 7:53am UTC](https://discuss.elastic.co/t/can-i-use-ilm-to-switch-index-code-to-deflate-after-40-days/358272/2 "2024-04-26T07:53:35Z")

</div>

Yes, you can specify the [index codec as part of a forcemerge action](https://www.elastic.co/guide/en/elasticsearch/reference/8.13/ilm-forcemerge.html) when transitioning to the warm phase. Only segments that are merged will get the new codec applied, so ideally set number of segments to 1. Ideally the index should be read-only after this point as you will have a single potentially large segment.

---

<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:** [May 24, 2024, 7:54am UTC](https://discuss.elastic.co/t/can-i-use-ilm-to-switch-index-code-to-deflate-after-40-days/358272/3 "2024-05-24T07:54:13Z")

</div>

Closed on May 24, 2024, 7:54am UTC

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