Geo_distance query - illegal latitude value that isn't the latitude I sent

I'm getting some odd behaviour when doing geo_distance queries via the Rest High Level API on elasticsearch v6.2.4.

For example, my query is this:

  "query": {
    "bool": {
      "must": [{
        "geo_distance": {
     "boost": 1.0

But it responds with this as the root_cause:

"reason":"illegal latitude value [264.375] for [geo_distance]"

What's happening here? That is not the latitude I queried with, as you can see.

Any help is much appreciated.

Update: I also notice that in the query the values are presented as [lon,lat] rather than [lat,lon]. I'm using the QueryBuilder correctly:

                            .point(lat, lon)
                            .distance(distance, unit)

According to the point method in the builder:

    public GeoDistanceQueryBuilder point(double lat, double lon) {

Turns out that this was because my proxy node was pointing at an older version of elasticsearch. The error doesn't make much sense, but there you go.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.