Can we use the ouput of query as input to other in same API request?


(trusha) #1

{
"size":0,
"aggs" : {
"avg_speed" : {"max" : {"field" : "Speed" } }
}
}


{
"query": {
"bool": {
"must": [
{
"range":{
"Speed":{
"gte":{"avg_speed"}
}
}
}
]
}
}
Can i club above two queries? I want to use avg_speed computed in first query in the next range query, is their any functionality like this?
Problem domain is: I want to compute documents that have speed range greater then average speed


(Adrien Grand) #2

There is no way to do this in a single request.


(system) #3