Reclaim disk space after deleting files in Elasticsearch

与世无争的帅哥 提交于 2021-01-28 03:02:18

问题


When I delete documents from Elasticsearch, why does my 'total size' stay the same despite obviously being far smaller with the absence of previously stored data? I've read about index optimization but I'm not sure what this is or how to do it.

Thanks


回答1:


I'm sure there are tons of questions relating to this on both SO and Google so this may be a duplicate answer. However - deleting documents only marks them as deleted, it doesn't actually remove them from your data store.

In old ES, there used to be a feature named 'optimize' (which is deprecated) - nowdays forcemerge is the enhanced replacement. The following command should free up the space you're entitled to.

curl -XPOST 'http://localhost:9200/_forcemerge?only_expunge_deletes=true'

Here's a bit more info on forcemerge if you're interested:

https://www.elastic.co/blog/found-elasticsearch-from-the-bottom-up



来源:https://stackoverflow.com/questions/45675537/reclaim-disk-space-after-deleting-files-in-elasticsearch

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!