Using geo distance in custom_score


(Mattias Pfeiffer) #1

Hi,

Thanks for a great product!

Is there a way to use a geo distance in a custom_score? Should I wrap
my custom_score around a _geo_distance-sort filter? I do not want to
filter by a distance, just calculate a custom score based on the
distance from a fixed point.

Thanks!


(Shay Banon) #2

Its not simple to access it from a script, but it should be. Something like
(assuming params include lat and lon to compute the distance from):

doc['geo_point_field'].distance(lat, lon)

Can you open a feature for it? should be simple to implement.

On Thu, Jan 6, 2011 at 8:01 AM, Mattias Pfeiffer <mattias.pfeiffer@gmail.com

wrote:

Hi,

Thanks for a great product!

Is there a way to use a geo distance in a custom_score? Should I wrap
my custom_score around a _geo_distance-sort filter? I do not want to
filter by a distance, just calculate a custom score based on the
distance from a fixed point.

Thanks!


(Mattias Pfeiffer) #3

Great - I've filed a feature request:

On Jan 6, 2:58 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Its not simple to access it from a script, but it should be. Something like
(assuming params include lat and lon to compute the distance from):

doc['geo_point_field'].distance(lat, lon)

Can you open a feature for it? should be simple to implement.

On Thu, Jan 6, 2011 at 8:01 AM, Mattias Pfeiffer <mattias.pfeif...@gmail.com

wrote:
Hi,

Thanks for a great product!

Is there a way to use a geo distance in a custom_score? Should I wrap
my custom_score around a _geo_distance-sort filter? I do not want to
filter by a distance, just calculate a custom score based on the
distance from a fixed point.

Thanks!


(system) #4