Is there any approach by using which i can pass the aggregation result as the input for other query. By aggregation result i mean the buckets key value. I want to use the "key" field value as the filter for other query. So, i can restrict the data to the key results. This i am trying to implement in java.
I am using two separate queries, if there is any better approach please suggest. Below is the response of my first query:
"data_aggregation": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "1",
"doc_count": 10
},
{
"key": "9",
"doc_count": 1
}
]
}
}
For this response i want to use key's value.