我正在使用范围分面进行搜索:
{
"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}
]
}
}
}
}
我得到了预期的范围作为响应:
[
{
"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": 5,
"min": 499.0,
"max": 599.0,
"total_count": 5,
"total": 2886.0,
"mean": 577.2
},
{
"from": 600.0,
"to": 800.0,
"count": 3,
"min": 690.0,
"max": 790.0,
"total_count": 3,
"total": 2179.0,
"mean": 726.3333333333334
},
{
"from": 800.0,
"count": 2,
"min": 899.0,
"max": 990.0,
"total_count": 2,
"total": 1889.0,
"mean": 944.5
}
]
在所有的响应中,
count
和 total_count
是相同的。有人知道它们之间的区别吗?我应该使用哪一个?