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获取到的多不少。

相关推荐
切糕师学AI3 小时前
如何查看已合并到 master 分支的所有分支?Git 分支清理指南
大数据·git·elasticsearch
suaizai_3 小时前
从1210条报错到全自动修复:AI闭环运维实战
大数据·elasticsearch·搜索引擎
Elastic 中国社区官方博客7 小时前
不再有分配延迟:在无状态 Elasticsearch 中将快照与分片迁移解耦
大数据·运维·人工智能·elasticsearch·搜索引擎·全文检索
玫瑰互动GEO9 小时前
工程视角看GEO优化与SEO优化:爬虫排序 vs 大模型引用
人工智能·爬虫·搜索引擎
百万运营Pro10 小时前
用 Astro + Supabase 从零构建全网盘聚合搜索引擎:PGroonga 中文检索实战
搜索引擎·前端框架·node.js·个人开发·学习方法·ai编程·资源分享
Elasticsearch11 小时前
在 ES|QL 中引入 SPARKLINE:一眼看清趋势
elasticsearch
Capricorn19881 天前
防编造架构实战:对比 Gemini Notebook 解析知芽 Notebook Skill 的工程实现
人工智能·笔记·elasticsearch·架构·知识图谱·论文笔记
玉&心1 天前
在Kibana查看Elasticsearch中的日志或存储的文档数据
elasticsearch·kibana
Elastic 中国社区官方博客1 天前
安装 Elasticsearch
大数据·数据库·elasticsearch·搜索引擎·全文检索