# Elasticsearch "delete by query" not released disk space

**URL:** https://discuss.elastic.co/t/elasticsearch-delete-by-query-not-released-disk-space/333768
**Category:** Elasticsearch
**Created:** [May 18, 2023, 12:14pm UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-not-released-disk-space/333768 "2023-05-18T12:14:11Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sanjeevtomar](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@sanjeevtomar](https://discuss.elastic.co/u/sanjeevtomar)
#### Post date: [May 18, 2023, 12:14pm UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-not-released-disk-space/333768/1 "2023-05-18T12:14:11Z")

</div>

After running "delete by query ", disk space did not released.  
What should I do to make disk space release?

---

<div class="post-metadata">

### Author: ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)
#### Post date: [May 18, 2023, 1:23pm UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-not-released-disk-space/333768/2 "2023-05-18T13:23:49Z")

</div>

Hi @sanjeevtomar

I recommend reading [force\_merge](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html) doc. Look this [post](https://discuss.elastic.co/t/how-to-get-rid-of-deleted-documents-and-reclaim-disk-space/303184/9).

---

<div class="post-metadata">

### Author: ![sanjeevtomar](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@sanjeevtomar](https://discuss.elastic.co/u/sanjeevtomar)
#### Post date: [May 18, 2023, 1:37pm UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-not-released-disk-space/333768/3 "2023-05-18T13:37:05Z")

</div>

Hi @RabBit_BR

\_forcemerge is also running.

---

<div class="post-metadata">

### Author: ![dhondup](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@dhondup](https://discuss.elastic.co/u/dhondup)
#### Post date: [May 18, 2023, 8:35pm UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-not-released-disk-space/333768/4 "2023-05-18T20:35:10Z")

</div>

@sanjeevtomar

That is a soft delete, it marks files as deleted but they still take space.

If you want to clean up space, you can use forcemerge which frees up the space used by deleted documents.

Forcemerge is resource intensive, you can use max\_num\_segments of 1 to fully merge it into 1 segment based on the index size. There is also the only\_expunge\_deletes option too.

Reference: [Force merge API | Elasticsearch Guide [8.7] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html)

---

<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: [June 15, 2023, 8:36pm UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-not-released-disk-space/333768/5 "2023-06-15T20:36:09Z")

</div>

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