小编Luc*_*nti的帖子

弹性搜索范围方面的count和total_count之间有什么区别?

我正在使用范围方面进行搜索:

{
"query": {
    "match_all": {}
},
"facets": {
    "prices": {
        "range": {
            "field": "product_price",
            "ranges": [
                {"from": 0, "to": 200},
                {"from": 200, "to": 400},
                {"from": 400, "to": 600},
                {"from": 600, "to": 800},
                {"from": 800}
            ]
        }
    }
}
}
Run Code Online (Sandbox Code Playgroud)

正如预期的那样,我得到了范围的响应:

[
  {
    "from": 0.0,
    "to": 200.0,
    "count": 0,
    "total_count": 0,
    "total": 0.0,
    "mean": 0.0
  },
  {
    "from": 200.0,
    "to": 400.0,
    "count": 1,
    "min": 399.0,
    "max": 399.0,
    "total_count": 1,
    "total": 399.0,
    "mean": 399.0
  },
  {
    "from": 400.0,
    "to": 600.0,
    "count": …
Run Code Online (Sandbox Code Playgroud)

range facet faceted-search elasticsearch

5
推荐指数
1
解决办法
1314
查看次数

标签 统计

elasticsearch ×1

facet ×1

faceted-search ×1

range ×1