ElasticSearch geo-information: the geo_distance filter returns geo-poles in an ellipse not in a circle

I have an elasksearch database of geo objects. I want to search for nearby objects around some geo_point at a user distance, and then display them on a Google map. using elasticsearch filters by default - the geo_distance filter, it works fine, but the problem is that the returned contacts are in the elliptical range and not in the circular range (as usual when searching for something in the X-km RADIUS), maybe screenshots will help understand.

I don’t know where the problem may be, google maps only accept a result that returns elasticity - a set of contacts to display

Does anyone know anything about this issue?

map without filtering

filtered map, the red circle shows actual border of searching

+4
source share
2 answers

When geo-points are represented as arrays in elasticsearch, they follow the GeoJSON format, which is [lon, lat] . So, from the point of view of elasticsearch, your central pin is not in Paris, but near the coast of Somalia.

+10
source

Based on your screen shots, I came up with a couple of points in your circle.

Suppose we have the central coordinate lat: 48.853647, lon: 2.347894 and a point in lat: 48.853647 lon: 2.32 (a point on the same lat, but further west):

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

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

Therefore, if the filtered distance is say 2.5 km, then using the distance_type: arc parameter will correctly include both points using the distance_type plane: the plane will include only the north point giving an elliptical shape.

+3
source

All Articles