Geo_point and geo_bounding_box


(jcl) #1

##Hi all,

have a problem with elasticsearch 2.1 and geo_bounding_box.

My ES configuration (docker image) :

version: {
number: "2.1.0",
build_hash: "72cd1f1a3eee09505e036106146dc1949dc5dc87",
build_timestamp: "2015-11-18T22:40:03Z",
build_snapshot: false,
lucene_version: "5.3.1"
},

I set up the mappings :

properties: {
  name: {
    type: "string"
  },
  pin: {
    type: "geo_point"
  }
}
```

Pins are stored correctly :

_source: {
name: "this is a name",
[...]
pin: {
lat: 50.5757616,
lon: 3.0771416
}
}


When i execute  the following query :

[{"query":{"bool":{"must":{"match_all":{}},"filter":{"geo_bounding_box":{"location":{"top_left":{"lat":50.5641649,"lon":3.095948},"bottom_right":{"lat":50.5819679,"lon":3.064912}}}}}}}]];


I have no results.

Seems like "geo_boundnig_box" is bugging... Indeed with a "geo_distance" filter I get 1 result...

Any tips ?

Thanks

(Colin Goodheart-Smithe) #2

It looks like your bottom_right point is to the left of your top_left point. This means that instead of your bounding box being a small square in the north of France, it will be a short but very wide rectangle stretching most of the way around the world. I am also noticing that there is the same issue for the top and bottom latitudes, the bottom latitude is above the top latitude. Try swapping the top_left and bottom_right coordinates in your query


(jcl) #3

@colings86 you're right the problem was in my Geocoder i switch northwest and southeast :wink:

Seems I was too focused on elasticsearch.

Thanks !


(system) #4