How to pass context variables to use in sub aggregations e.g. _term

Hi,

I wonder if there is any possibility to access upper level aggregation
results in sub aggregation?

Example:

Run a terms aggregation and get "_term" variable result in sub
aggregations.

"aggs" : {
"pairs" : {
"terms" : { "script" : "_source['pairs'].keySet()" }
aggs: {
"sum" : { "script" : "_source['pairs'].get(_term)" }
}
}
}

_term variable can be used for ordering of terms aggregation result but not
available at sub-aggregation.
It would be very nice if there is some way to provide it to sums
aggregation. I found in documentation that _value could be set outside
script....

Best regards,
Evgeny Ryabitskiy.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/eb618ee2-d71f-48d2-93cf-d18d4e3588eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.