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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to