Hi,

Unfortunately, accessing the parent bucket key is not possible.


On Fri, May 2, 2014 at 12:04 AM, Thomas Gruner <tom.gru...@gmail.com> wrote:

> Hello!
>
> I have been progressing well with aggregations, but this one has got me
> stumped.
>
> I'm trying to figure out how to access the key of the parent bucket from a
> child aggregation.
>
> The parent bucket is geohash_grid, and the child aggregation is avg
> (trying to get avg lat and lon, but only for points that match the parent's
> bucket's geohash key)
>
> Something like this:
> "aggregations" : {
>     "LocationsGrid": {
>         "geohash_grid" : {
>             "field" : "Locations",
>             "precision" : 7,
>         },
>         "aggregations" : {
>             "avg_lat": {
>                 "avg": {
>                     "script": "if
> (doc['Locations'].value.geohash.startsWith(*parent_bucket.key*))
> doc['Locations'].value.lat;"
>                 }
>             }
>         },
>     }
> }
>
>
> Thanks for any help or ideas with this!
>
>  --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/624d0bdd-c380-4c72-b642-e6afff3458a9%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/624d0bdd-c380-4c72-b642-e6afff3458a9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Adrien Grand

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j4fxXs4eQeh7SJ5KQyVbPuqd2bLKfWRmdRDsc%3DiCwkgdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to