I have a question about elasticsearch aggregations.How to get bucket count before bucket_sort paged, code:
"aggs": {
...
"fitler": {
"bucket_selector": {
"buckets_path": {
"orderCount": "_count"
},
"script": "params.orderCount == 1",
"gap_policy": "skip"
}
},
"r_bucket_sort":{
"bucket_sort": {
"sort": [{"user_sort":{"order":"desc" }}],
"from": 1,
"size": 5
}
}
}
},
"total":{
"cardinality": {
"field":"id.keyword"
}
}
the total cant return bucket count.