5

i have elasticsearch database of geo objects. I want to search the nearest objects around some geo_point in custom distance and then display them on google map. using default elasticsearch filters - geo_distance filter, it works fine, but the problem is that returned pins are in eliptical range, not in circular range (as usually when you search anything in X km RADIUS) maybe screenshots would help to understand.

I don't know where the problem can be, google maps only takes the result that elastic returns - set of pins to display

Does anybody know anything about this issue?

map without filtering

filtered map, the red circle shows actual border of searching

4

2 回答 2

11

When geo points are represented as arrays in elasticsearch they are following GeoJSON format, which is [lon, lat]. So, from elasticsearch perspective, your center pin is not in Paris but just off the coast of Somalia.

于 2012-06-14T17:22:40.763 回答
3

Based on your screenshots I came up with a couple of points in your circle.

Assuming we have centre coordinate of lat:48.853647, lon:2.347894, and a point at lat:48.853647 lon:2.32 (a point at the same lat but further west):

Using distance_type:plane the distance calculated is ~ 3.1km, while using distance_type:arc the distance is ~ 2km.

If we use a different point, lat:48.8717 lon:2.347894 (further north of the centre point, but some lon), using distance_type:plane the distance is ~ 2km and using distance_type:arc it is also ~ 2km.

Consequently if the filtered distance was say 2.5km, then using distance_type:arc would correctly include both points, while using distance_type:plane would only include the northern point, giving the elliptical shape.

于 2012-06-14T12:25:56.993 回答