Is there any way to use one query aggregation result as the filter for other query

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.

The Graph API effectively does this to walk the connections in data: https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html

This is available as part of a Platinum subscription and has a graph visualization GUI to show connections. You can check it out for a trial period if you don't have a subscription

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.