# Delete Documents Index

**URL:** <https://discuss.elastic.co/t/delete-documents-index/277777>\
**Category:** Logs\
**Created:** [July 5, 2021, 6:54am UTC](https://discuss.elastic.co/t/delete-documents-index/277777 "2021-07-05T06:54:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kirtash](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@Kirtash](https://discuss.elastic.co/u/Kirtash)\
**Post date:** [July 5, 2021, 6:54am UTC](https://discuss.elastic.co/t/delete-documents-index/277777/1 "2021-07-05T06:54:19Z")

</div>

Hi all!!

I have read the documentation about the lifecicle but I have a simple question about it. Is possible delete the documents after X days?

I don't want to keep the docs because they are only to debug.

Thanks for all!

---

<div class="post-metadata">

**Author:** ![afgomez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/afgomez/32/59274_2.png) [@afgomez](https://discuss.elastic.co/u/afgomez)\
**Post date:** [July 5, 2021, 2:13pm UTC](https://discuss.elastic.co/t/delete-documents-index/277777/2 "2021-07-05T14:13:14Z")

</div>

Hi @Kirtash. Thanks for your question!

There is no way to automatically remove documents from an index within elasticsearch. The closest thing would be a lifetime policy that:

1. Performs a rollover of the index every day.
2. Removes indices that are older that X days.

Another option would be to trigger a delete query using an external scheduler, like a cronjob.

---

<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:** [August 2, 2021, 2:13pm UTC](https://discuss.elastic.co/t/delete-documents-index/277777/3 "2021-08-02T14:13:51Z")

</div>

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