elasticsearch:删除文档后如何释放存储大小 [英] elasticsearch: how to free store size after deleting documents
问题描述
在我的弹性搜索服务器上:文件总数:300万,总大小:3.6G然后,我删除了大约 280 万个文档:文件总数:约13万,总大小:3.6G
On my elasticsearch server: total documents: 3 million, total size: 3.6G Then, I delete about 2.8 millions documents: total documents: about 0.13 million, total size: 3.6G
我删除了文件,如何释放文件大小?
I have deleted the documents, how should I free the size of the documents?
推荐答案
删除文档只会将这些文档标记为已删除,因此不会被搜索.要回收磁盘空间,您必须优化索引:
Deleting documents only flags these as deleted, so they would not be searched. To reclaim disk space, you have to optimize the index:
curl -XPOST 'http://localhost:9200/_optimize?only_expunge_deletes=true'
文档:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-optimize.html
文档已移至:https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html
从 Elasticsearch 2.1.x 开始,优化
在赞成 forcemerge<中已弃用/代码>.API 相同,只有端点发生了变化.
Starting with Elasticsearch 2.1.x, optimize
is deprecated in favor of forcemerge
.
The API is the same, only the endpoint did change.
curl -XPOST 'http://localhost:9200/_forcemerge?only_expunge_deletes=true'
这篇关于elasticsearch:删除文档后如何释放存储大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!