elasticsearch _cat/indices docs.count is different than <index>/_count

今天遇到一个问题,kibana中看到文档数与下面语句查询到的不同

bash 复制代码
GET /_cat/count/jiankunking_xxxxx_product_expand_test?v
GET /jiankunking_xxxxx_product_expand_test/_search?track_total_hits=true

语句查询结果

bash 复制代码
epoch      timestamp count
1711433785 06:16:25  508666675

kibana数据

kibana这里看到的数据与GET _cat/indices?v获取到的结果是一样的

语句

bash 复制代码
GET _cat/indices/jiankunking_xxxxx_product_expand_test?v

结果

bash 复制代码
health status index                                  uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   jiankunking_xxxxx_product_expand_test7BbNsDs_RVyOR1Wn4LZoDA   6   0  894203500        88097    336.8gb        336.8gb

那么到底哪个是对的呢?

在GitHub中找到了原因:https://github.com/elastic/elasticsearch/issues/25868

cat api 和 count api 之间存在差异。前者查看的是 Lucene 统计,而后者执行的是查询。Lucene 统计会考虑到已删除的文档和嵌套文档,而这两种情况都隐藏在搜索次数中。

由于jiankunking_xxxxx_product_expand_test中有多个nested属性,所以cat的数量是比count api获取到的多不少。

相关推荐
不仙5201 天前
VMware Workstation 26.0.0 在 Ubuntu 24.04 (内核 6.17.0) 上的安装与内核模块编译问题
linux·ubuntu·elasticsearch
qziovv1 天前
Git 回退场景
大数据·git·elasticsearch
ZeroNews内网穿透1 天前
面向 AI 协作的本地客户端能力:ZeroNews Agent Skills
大数据·人工智能·elasticsearch
Elastic 中国社区官方博客1 天前
快 12 倍的 Elasticsearch 向量索引:使用 GPU 和 CPU 分层部署 NVIDIA cuVS
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索·nvidia
海兰1 天前
【实用应用】React+TypeScript+Next.js博客项目
开发语言·javascript·elasticsearch
乐观的Terry1 天前
博客系统全文搜索实战:用 Elasticsearch 告别 MySQL LIKE 查询
mysql·elasticsearch
敖正炀2 天前
索引写入与数据持久化深度
elasticsearch
Achou.Wang2 天前
Docker 多阶段构建:优化 Go 应用镜像大小的最佳实践
elasticsearch·docker·golang
comcoo2 天前
OpenClaw AI 聊天网关配置教程|Gateway 启动与完整使用指南
运维·人工智能·elasticsearch·gateway·openclaw安装包·open claw部署
Keano Reurink2 天前
AI内容检测:用SERP对比识别搜索引擎眼中的“优质内容“
人工智能·搜索引擎·chatgpt