I want to count all the unique sellers whose sell sum should be greater than 100.
I have tried this approach using terms aggregation but this will return a bucket list. But what I want is only the total seller count whose sell sum should be greater than 100.
Is there any way to do this using cardinality or anything else?
I have also tried with cardinality but not worked.
Query
{
"size": 0,
"aggregations": {
"seller_count": {
"terms": {
"field": "seller_id"
},
"aggregations": {
"total_sell": {
"sum": {
"field": "sell"
}
},
"sell_bucket_filter": {
"bucket_selector": {
"buckets_path": {
"totalSell": "total_sell"
},
"script": {
"source": "params.totalSell > 100"
}
}
}
}
}
}
}