GeoDistance query doesn't work with distance unit equal to miles


(Ayush Sangani) #1

Hello Everyone,

I am using GeoDistance Query inside post_filter which works well with distance_unit = km.
But when I change it to miles it gives me an exception:

Sample Query:

   {
    "aggregations": {
    "nested_geopoint": {
      "aggregations": {
        "zoomedInView": {
          "filter": {
            "geo_bounding_box": {
              "addresses.location": {
                  "top_left": {
                              "lat": 42.3577323732945,
                              "lon": -71.0593786189176
                           },
                           "bottom_right": {
                              "lat": 42.3523895073352,
                              "lon": -71.0499948394231
                           }
              }
            }
          },
          "aggs" : {
              "zoom1": {
          "geohash_grid": {
            "field": "addresses.location",
            "precision": 8
          },
          "aggs" : {
              "cell" : {
                  "geo_bounds" : {
                      "field" : "addresses.location"
                  }
              }
          }
        }
          }
        }
      },
      "nested": {
        "path": "addresses"
      }
    }
  },
   "post_filter": {
   "nested": {
     "path": "addresses",
     "query": {
       "filtered": {
         "filter": {
           "geo_distance": {
             "distance": 1,
             "distance_unit": "miles",
             "addresses.location": {
               "lat":-71.004999999999995,
               "lon": 42.341760000000001
             }
           }
         }
       }
     }
   }
 }
}

In above query location is a nested field. post-filter is used after aggregations. After executing this query it throws below exception:

  nested: ElasticsearchIllegalArgumentException[the character 'i' is not a valid geohash character]; }]",
       "status": 400

Please let me know if I'm doing something wrong or any other clarification is required.

Thanks


(Mark Walkom) #2

Very odd, that looks valid according to the docs.

What version are you on?


(Ayush Sangani) #3

Thanks for the reply @warkolm.
I'm using ES 1.4.4.
Apparently post_filter also doesn't have any effect on the results, anyways that's a separate issue to discuss.


(system) #4