# Delete documents by query and disk storage

**URL:** <https://discuss.elastic.co/t/delete-documents-by-query-and-disk-storage/210746>\
**Category:** Elasticsearch\
**Created:** [December 5, 2019, 4:38pm UTC](https://discuss.elastic.co/t/delete-documents-by-query-and-disk-storage/210746 "2019-12-05T16:38:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nonow53](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nonow53/32/81767_2.png) [@Nonow53](https://discuss.elastic.co/u/Nonow53)\
**Post date:** [December 5, 2019, 4:38pm UTC](https://discuss.elastic.co/t/delete-documents-by-query-and-disk-storage/210746/1 "2019-12-05T16:38:20Z")

</div>

Hi,

I use Delete by Query API to delete old documents.  
On the monitoring console, I can see the storage size of the index was not changed.  
I can see the file for this index in DATA folder is still present.  
If the index contains zero document, will be deleted or not ?

Thank you  
Arnaud

---

<div class="post-metadata">

**Author:** ![loren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/loren/32/44942_2.png) [@loren](https://discuss.elastic.co/u/loren)\
**Post date:** [December 5, 2019, 8:26pm UTC](https://discuss.elastic.co/t/delete-documents-by-query-and-disk-storage/210746/2 "2019-12-05T20:26:56Z")

</div>

Delete just marks docs as deleted. It doesn't reclaim any space. Segment merging done automatically/periodically by Lucene reduces the disk usage. This is not the ideal way to retire old documents.

The best way to deal with expiring old documents is via time-based indices and [index lifecycle management](https://www.elastic.co/guide/en/elasticsearch/reference/master/getting-started-index-lifecycle-management.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:** [January 2, 2020, 8:27pm UTC](https://discuss.elastic.co/t/delete-documents-by-query-and-disk-storage/210746/3 "2020-01-02T20:27:04Z")

</div>

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