Finding the closest geo_point to a given one in 5.x

Because of the change to BKD trees for geo_point type, in order to efficiently find the closest point in a stored database to a given point a simple search with limit on size is enough?

GET geodatabase/location/_search
{
	sort: {
		_geo_distance: {
			coordinates: {
				lat: 23,
				lon: 23
			},
			order: "asc",
			unit: "km"
		}
	},
	size: 1
}

Previously we would also filter by geohash_cell with a precision of 5 and decrease it until a match was found.

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