繁体   English   中英

_stats与_count返回的弹性搜索文档计数

[英]Elasticsearch document count returned by _stats versus _count

我正在尝试获取弹性搜索集群中的索引的统计数据/计数(1.2.1)。 我使用Indices Stats API (_stats端点)来获取主文档的总数及其在磁盘上的大小。 但是,我开始尝试使用Count API (_count端点)并注意到值不对齐。

这些值有什么区别? 虽然文档中的线索表明刷新索引时Indicies Stats返回的值可能会发生变化,但文档中并未完全清楚。 这让我想知道这是否是Lucene层的低级值。

指数统计API

localhost:9200/my_index/_stats

...snip...

"_all" : {
  "primaries" : {
    "docs" : {
      "count" : 8284,
      "deleted" : 87
    },
  }
}

...snip...

计算API

localhost:9200/my_index/_count

{
  "count" : 6854,
  "_shards" : {
    "total" : 40,
    "successful" : 40,
    "failed" : 0
  }
}

实际上,从Indices stats API返回的docs.count还包括索引中存在的嵌套文档的数量,因此它总是大于或等于从Count API返回的计数,它只返回计数的计数顶级文档,即将从搜索查询返回的文档。

因此,根据您发布的数字判断,您的索引看起来像包含类型nested在映射中的字段的文档。 听起来不错?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM