如何从 elasticsearch 的 cat-indices 页面中清除 docs.deleted?

How to clear docs.deleted from cat-indices page of elasticsearch?

有一些文档 ID 被 elasticsearch 拒绝并添加到 es 的 docs.deleted 部分。 我已经解决了这些文档 ID 的问题。 我的 logstash 仍在读取数据,在 es 中,它没有增加文档计数,而是增加了 docs.deleted 计数。 我使用 Curl 来检查那些文档 ID,输出显示 {"found":false}.

我需要阅读那些文档 ID。 有什么方法可以清除 docs.deleted 部分吗?

下面是我的 es cat-index 的快照:

yellow open posdata                         74WTmacrRKeyBXMHuiUxgw 5 1 2172567 122443   3.6gb   3.6gb

使用强制合并解决了这个问题

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html

curl -XPOST 'localhost:9200/indexname/_forcemerge?max_num_segments=1'

编辑:

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