erbin 发表于 2017-11-6 21:11:29

ElasticSearch删除索引后如何释放磁盘空间

搭了一个单机的es,通过bulk方式删除掉一部分索引后,记录的确检索不到了,但是看磁盘空间并没有释放出来,删除索引后还需要做什么flush操作吗?
curl -XPOST 'localhost:9200/searchrecord/lastweek/_bulk?pretty' --data-binary @deleteIndex.json


erbin 发表于 2017-11-7 14:11:31

找到答案了,es删除索引后只是把索引标记为已删除,需要手动执行forcemerge才会真正的删除掉。
https://stackoverflow.com/questions/20608417/elasticsearch-how-to-free-store-size-after-deleting-documentshttps://www.elastic.co/guide/en/elasticsearch/reference/5.6/indices-forcemerge.html
curl -XPOST 'http://localhost:9200/searchrecord/_forcemerge?only_expunge_deletes=true'

easthome001 发表于 2017-11-7 14:40:08

erbin 发表于 2017-11-7 14:11
找到答案了,es删除索引后只是把索引标记为已删除,需要手动执行forcemerge才会真正的删除掉。
https://st ...

那就是它只是改变了里面的标记,并未真正删除。

erbin 发表于 2017-11-7 15:02:57

easthome001 发表于 2017-11-7 14:40
那就是它只是改变了里面的标记,并未真正删除。
是的。调用forcemerge也不是真正的删除,而是重新创建了不包含已删除的doc的segments。
In Lucene, a document is not deleted from a segment, just marked as deleted.
During a merge process of segments, a new segment is created that does not have those deletes.
页: [1]
查看完整版本: ElasticSearch删除索引后如何释放磁盘空间