【问题标题】:ES bulk indexing shows few documents deletedES 批量索引显示删除的文档很少
【发布时间】:2021-07-31 21:54:57
【问题描述】:

我在 ES 中索引了 443663 个文档。 当我执行 GET /_stats 时,它会显示

"primaries":{
"docs:{
"count": 443625,
"deleted":38
}
}
}

有趣的是 count+deleted = 443663 奇怪的是它为什么要删除那些?

提前感谢您的帮助

【问题讨论】:

  • 您的批量中有“删除”命令还是只有“索引”命令?
  • 只是“索引”命令

标签: elasticsearch indexing


【解决方案1】:

这是因为在您的批量调用中,您有 38 个重复的 id,即一个文档的 38 个命令与另一个已被索引的文档具有相同的 id。

很容易复制:

POST test2/_doc/_bulk
{"index": {"_id": 1}}
{"test": 1}
{"index": {"_id": 1}}
{"test": 1}
{"index": {"_id": 2}}
{"test": 1}
{"index": {"_id": 3}}
{"test": 1}

现在 GET test2/_stats 会产生这个,因为 ID 为 1 的文档被索引了两次:

"primaries" : {
  "docs" : {
    "count" : 3,
    "deleted" : 1
  },

【讨论】:

  • 非常感谢瓦尔。
  • 酷,很高兴它有帮助!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-03-11
  • 1970-01-01
  • 2013-05-06
  • 2017-10-28
  • 2014-05-05
  • 2017-05-14
  • 1970-01-01
相关资源
最近更新 更多