i am using a geo_distance
filter with tire in my query and it works fine:
search.filter :geo_distance, :distance => "#{request.distance}km", :location => "#{request.lat},#{request.lng}"
i expected that the result would somehow include the computed distance to the geo-location that i used for my filter.
is there a way to tell elasticsearch to include that in the response, so that i don't have to calculate it in ruby for every result?
== UPDATE ==
i found the answer in a google group:
search.sort do
by "_geo_distance", "location" => "#{request.lat},#{request.lng}", "unit" => "km" if request.with_location?
end
sorting by the _geo_distance
will yield the distance in the raw results.