Need to filter the documents based on aggregated results in kibana discover .
{
"aggs": {
"match_id": {
"terms": {
"field": "MATCH_ID",
"size": 10000
},
"aggs": {
"count_id": {
"terms": {
"field": "MATCH_ID"
}
},
"filtering_agg": {
"bucket_selector": {
"buckets_path": {
"total_ids": "count_id"
},
"script": {
"source": "params.total_ids == 2"
}
}
}
}
}
}
}
is there any way to apply aggregation and filter documents in Discover .