我正在使用范围方面进行搜索:
{
"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)