# Delete document from elasticsearch

**URL:** <https://discuss.elastic.co/t/delete-document-from-elasticsearch/260910>\
**Category:** Elasticsearch\
**Created:** [January 12, 2021, 9:41pm UTC](https://discuss.elastic.co/t/delete-document-from-elasticsearch/260910 "2021-01-12T21:41:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mac1](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@mac1](https://discuss.elastic.co/u/mac1)\
**Post date:** [January 12, 2021, 9:41pm UTC](https://discuss.elastic.co/t/delete-document-from-elasticsearch/260910/1 "2021-01-12T21:41:53Z")

</div>

hi,  
delete\_by\_query is safe to delete huge volume of data (in gbs) in one go. Will it create any performance issues in ES.  
Will it free the space automatically ?

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [January 12, 2021, 9:44pm UTC](https://discuss.elastic.co/t/delete-document-from-elasticsearch/260910/2 "2021-01-12T21:44:22Z")

</div>

- Yes, delete\_by\_query is I/O intensive, run with `wait_for_completion=false` as a background task and then check task progress with (GET \_tasks)
- Run POST \_refresh at the end to free disk space
- I would choose to reindex the data that need to be keeped to a new index and delete the whole index 🙂 if you will delete more data than what you will keep
- For future structure your data into timeseries indexes if possible (daily, weekly, monthly) and use ILM with rollover  
...

---

<div class="post-metadata">

**Author:** ![mac1](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@mac1](https://discuss.elastic.co/u/mac1)\
**Post date:** [January 12, 2021, 9:58pm UTC](https://discuss.elastic.co/t/delete-document-from-elasticsearch/260910/3 "2021-01-12T21:58:20Z")

</div>

thanks for the reply

I read somewhere that to free space in ES ,have to use force merge .delete\_by\_query alone will not free up the memory .

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 12, 2021, 10:01pm UTC](https://discuss.elastic.co/t/delete-document-from-elasticsearch/260910/4 "2021-01-12T22:01:26Z")

</div>

Welcome to our community! 😃

Can you please reformat your posts, as they are very hard to read 🙂

---

<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 9, 2021, 10:01pm UTC](https://discuss.elastic.co/t/delete-document-from-elasticsearch/260910/5 "2021-02-09T22:01:50Z")

</div>

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