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

相关推荐
Elasticsearch18 分钟前
快速 vs. 准确:衡量量化向量搜索的召回率
elasticsearch
柯儿的天空1 小时前
【OpenClaw 全面解析:从零到精通】第 004 篇:OpenClaw 在 Linux/Ubuntu 上的安装与部署实战
linux·人工智能·ubuntu·elasticsearch·知识图谱
逸Y 仙X2 小时前
文章八:ElasticSearch特殊数据字段类型解读
java·大数据·linux·运维·elasticsearch·搜索引擎
逸Y 仙X2 小时前
文章九:ElasticSearch索引字段常见属性
java·大数据·服务器·数据库·elasticsearch·搜索引擎
历程里程碑3 小时前
链表--排序链表
大数据·数据结构·算法·elasticsearch·链表·搜索引擎·排序算法
逸Y 仙X3 小时前
文章十:ElasticSearch索引字段高级属性
java·大数据·elasticsearch·搜索引擎·全文检索
weixin_446260853 小时前
一款提升工作效率的Claude HUD插件
大数据·elasticsearch·搜索引擎
贾斯汀玛尔斯16 小时前
kinbana中无法在discover中显示在ES中创建的索引--解决方案
大数据·elasticsearch·搜索引擎
大傻^1 天前
Spring AI Alibaba 向量数据库集成:Milvus与Elasticsearch配置详解
数据库·人工智能·spring·elasticsearch·milvus·springai·springaialibaba