GeoDistance Aggregation is not working with Nested Aggregation

(Ayush Sangani) #1

Hello all,

I'm using GeoDistance Aggregation on a nested field so it is wrapped around a nested aggregation. This query is being run ES 1.6.0 and encountering an exception which I'm unable to solve. Please also take a look at the query if it is the right way to use GeoDistance Aggregation.


   "aggs": {
      "nested_geodistance": {
         "nested": {
            "path": "addresses"
         "aggs": {
            "per_ring": {
               "geo_distance": {
                  "field": "addresses.location",
                  "unit": "km",
                  "orgin": {
                     "lat": 56.78,
                     "lon": -12.34
                  "ranges": [
                        "from": 100,
                        "to": 200

After executing this query I'm getting below exception:

Parse Failure [Unexpected token START_OBJECT in [per_ring].]]; }{[F8SeZ5RjR_KpSnvWBOSg7w][prod-contacts-0][4]: RemoteTransportException

I have revisited my query multiple times but unable to figure out what's wrong with my aggregation name.
Please let me know if further information is needed.


(Colin Goodheart-Smithe) #2

This is the issue. This should be origin. Not sure why the error is so cryptic though. I've raised a bug to fix the error message to be something more helpful:

(Ayush Sangani) #3

Wow..!! I wonder how I missed that.
Thank you Colin

(Colin Goodheart-Smithe) #4

No worries, it took me a little while to see it :smile:

(system) #5