# .ml-state too big

**URL:** <https://discuss.elastic.co/t/ml-state-too-big/247366>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-machine-learning\
**Created:** [September 3, 2020, 10:31am UTC](https://discuss.elastic.co/t/ml-state-too-big/247366 "2020-09-03T10:31:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![usrigp](https://avatars.discourse-cdn.com/v4/letter/u/ecd19e/32.png) [@usrigp](https://discuss.elastic.co/u/usrigp)\
**Post date:** [September 3, 2020, 10:31am UTC](https://discuss.elastic.co/t/ml-state-too-big/247366/1 "2020-09-03T10:31:25Z")

</div>

Hi

We have the index .ml\_state with a size in disk almost 60Gb on disk. Is it possible to purge any data or apply an ILM policy to make rollover? As it is a system index we do not know if it is possible to apply ILM.

ES version 7.1.  
Thanks.

---

<div class="post-metadata">

**Author:** ![droberts195](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/droberts195/32/17692_2.png) [@droberts195](https://discuss.elastic.co/u/droberts195)\
**Post date:** [September 3, 2020, 10:50am UTC](https://discuss.elastic.co/t/ml-state-too-big/247366/2 "2020-09-03T10:50:00Z")

</div>

You are probably suffering from [the bug that meant we didn't clean up the ML state index](https://github.com/elastic/elasticsearch/issues/47003#issuecomment-534961774). This was fixed in version 7.4.1. If you don't want to upgrade you can manually call the [delete expired data endpoint](https://www.elastic.co/guide/en/elasticsearch/reference/7.1/ml-delete-expired-data.html) periodically.

> As it is a system index we do not know if it is possible to apply ILM.

This won't work in 7.1. We [apply ILM automatically to the ML state index](https://github.com/elastic/elasticsearch/pull/52356) starting in version 7.7.0. But you will have to upgrade to get that functionality - it won't work if you try to apply it yourself in an earlier version. However, you may well find that after calling the deleted expired data endpoint your index is small enough not to need ILM.

---

<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:** [October 1, 2020, 10:50am UTC](https://discuss.elastic.co/t/ml-state-too-big/247366/3 "2020-10-01T10:50:01Z")

</div>

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