# ILM to delete only doc counts in a simple indice elasticsearch

**URL:** <https://discuss.elastic.co/t/ilm-to-delete-only-doc-counts-in-a-simple-indice-elasticsearch/351714>\
**Category:** Elasticsearch\
**Created:** [January 24, 2024, 1:52pm UTC](https://discuss.elastic.co/t/ilm-to-delete-only-doc-counts-in-a-simple-indice-elasticsearch/351714 "2024-01-24T13:52:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Musled](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/musled/32/131077_2.png) [@Musled](https://discuss.elastic.co/u/Musled)\
**Post date:** [January 24, 2024, 1:52pm UTC](https://discuss.elastic.co/t/ilm-to-delete-only-doc-counts-in-a-simple-indice-elasticsearch/351714/1 "2024-01-24T13:52:01Z")

</div>

Hi there !

I'm working on a lifecycle for my indices in elasticsearch.

To put you in context, I recover the logs of 20 applications with the ELK stack but I notice that my storage disk is filling up very quickly.

Therefore, I would like to create a lifecycle policy to delete the docs from an index older than 30 days (but keep the index all the same).

Is that possible ?

Thanks in advance

---

<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 24, 2024, 1:55pm UTC](https://discuss.elastic.co/t/ilm-to-delete-only-doc-counts-in-a-simple-indice-elasticsearch/351714/2 "2024-01-24T13:55:35Z")

</div>

No, that is not possible using ILM. ILM works by deleting complete indices and can not selectively delete data from within an index.

You probably need to periodically delete data using a delete-by-query job, possibly runvia a shell script triggered through cron. There is no built-in support for this in Elasticsearch or Kibana.

---

<div class="post-metadata">

**Author:** ![Musled](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/musled/32/131077_2.png) [@Musled](https://discuss.elastic.co/u/Musled)\
**Post date:** [January 24, 2024, 1:59pm UTC](https://discuss.elastic.co/t/ilm-to-delete-only-doc-counts-in-a-simple-indice-elasticsearch/351714/3 "2024-01-24T13:59:24Z")

</div>

Ok got it !

Thank you for your answer

---

<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 21, 2024, 2:00pm UTC](https://discuss.elastic.co/t/ilm-to-delete-only-doc-counts-in-a-simple-indice-elasticsearch/351714/4 "2024-02-21T14:00:25Z")

</div>

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