How to Delete (Hard Delete) document from Elasticsearch Disk?

(Harshal Chaudhari) #1


I am trying to delete a document from elastic search (using .Net NEST library), but a document is not deleted from a segment, just marked as deleted. (does not free the disk space.)

Could you please let us know how to delete a document from elastic search disk and in other words how to free the disk space.

Thanks in advance.


(Christian Dahlqvist) #2

Perform the delete and then run a force merge with max_num_segments set to 1 or the only_expunge_deletes parameter. Be aware that this is an expensive operation in terms of processing and disk I/O.

(Harshal Chaudhari) #3

I have deleted the existing all index and document and now i want to free the space from Elastic search, Please let me know how i can.

Thank you!, I will try above fix.

(Harshal Chaudhari) #4

Could you please help us here, i have tried below

POST /kimchy/_forcemerge?only_expunge_deletes=false&max_num_segments=100&flush=true

but no luck.

(Christian Dahlqvist) #5

That is not what I recommended. Try POST /indexname/_forcemerge?max_num_segments=1&flush=true or POST /indexname/_forcemerge?only_expunge_deletes=true.

Be aware it is an expensive operation and can take some time to run.

(Harshal Chaudhari) #6

Thanks for quick response, let me try,

If i have already deleted the index in that case what I will do.

(Mark Walkom) #7

if you have deleted the index, you will not be able to run a force merge on i.

(Harshal Chaudhari) #8

Could you please let me know so how i can free the disk space for same.

Thanks again for response.

(Christian Dahlqvist) #9

If you have deleted the index the disk space has been freed, hasn’t it? I am not sure I understand the question.

(Harshal Chaudhari) #10

Hi Christian,

I am using Cerebro tool (Please see below screen 1)
Note: In below screen there is no any index exist, still showing the disk utilization.

For reference (Screen 2)

Please guide me how i can free up the disk space.

Thank You!

Harshal Chaudhari

(Christian Dahlqvist) #11

When Elasticsearch deletes an index the data files are removed. If you log into the box, what is taking up space? How large was the index you deleted?

(system) closed #12

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