# Are tasks automatically purged after a period of time?

**URL:** <https://discuss.elastic.co/t/are-tasks-automatically-purged-after-a-period-of-time/188735>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [July 3, 2019, 2:03pm UTC](https://discuss.elastic.co/t/are-tasks-automatically-purged-after-a-period-of-time/188735 "2019-07-03T14:03:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PleaseGodHelpMe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pleasegodhelpme/32/46835_2.png) [@PleaseGodHelpMe](https://discuss.elastic.co/u/PleaseGodHelpMe)\
**Post date:** [July 3, 2019, 2:03pm UTC](https://discuss.elastic.co/t/are-tasks-automatically-purged-after-a-period-of-time/188735/1 "2019-07-03T14:03:46Z")

</div>

I'm using NEST and switching from using the DeleteMany method to DeleteByQuery so that I can quickly delete items where I only know the ID. DeleteByQuery also has an option for us to disable wait\_for\_completion. I read that this results in a task being created, and you can later cancel/delete that task. For my purposes, I don't want to do either. Can I update a global setting to clean up these completed tasks or what is the best course of action here?

---

<div class="post-metadata">

**Author:** ![PleaseGodHelpMe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pleasegodhelpme/32/46835_2.png) [@PleaseGodHelpMe](https://discuss.elastic.co/u/PleaseGodHelpMe)\
**Post date:** [July 5, 2019, 1:23pm UTC](https://discuss.elastic.co/t/are-tasks-automatically-purged-after-a-period-of-time/188735/2 "2019-07-05T13:23:25Z")

</div>

Is this not something that should be well-documented?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [July 5, 2019, 2:00pm UTC](https://discuss.elastic.co/t/are-tasks-automatically-purged-after-a-period-of-time/188735/3 "2019-07-05T14:00:02Z")

</div>

As far as I know a delete-by-query task is always created, whether you set `?wait_for_completion` or not. It should also be cleaned up on completion automatically.

---

<div class="post-metadata">

**Author:** ![PleaseGodHelpMe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pleasegodhelpme/32/46835_2.png) [@PleaseGodHelpMe](https://discuss.elastic.co/u/PleaseGodHelpMe)\
**Post date:** [July 5, 2019, 5:24pm UTC](https://discuss.elastic.co/t/are-tasks-automatically-purged-after-a-period-of-time/188735/4 "2019-07-05T17:24:06Z")

</div>

Thank you. So in that case I should generally only see improvements in response times with the caveat that I'm not catching errors. Great!

---

<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, 2019, 5:24pm UTC](https://discuss.elastic.co/t/are-tasks-automatically-purged-after-a-period-of-time/188735/5 "2019-08-02T17:24:12Z")

</div>

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