Is it possible to compute the geo distance for an array of sub objects containing a geo point

I have an index describing clinical trials. Often a clinical trial has
multiple locations that a patient can receive care at. Ideally, I would
like to compute the distance from a user's current geolocation to each of
the trial locations, so that I can display the distance to the closest
location pertaining to the trial.

I attempted to used a script_field in order to do this.
I created a gist that creates my simple index and populates some data and
then attempts to calculate the shortest distance from current location.
Any insight as to what I can do to resolve this issue is greatly
appreciated.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

one other note. I cant sort by distance. I sort based on a custom scoring
algorithm that determines which clinical trials match a patients condition.

On Monday, September 16, 2013 5:42:19 PM UTC-7, Nick Tackes wrote:

I have an index describing clinical trials. Often a clinical trial has
multiple locations that a patient can receive care at. Ideally, I would
like to compute the distance from a user's current geolocation to each of
the trial locations, so that I can display the distance to the closest
location pertaining to the trial.

I attempted to used a script_field in order to do this.
I created a gist that creates my simple index and populates some data and
then attempts to calculate the shortest distance from current location.
Any insight as to what I can do to resolve this issue is greatly
appreciated.

clinical trials with multiple locations. Attempt to find the distance from your current geo location to the closest trial location · GitHub

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Nick

You could use sort_mode: min in your _geo_distance sort clause to get the
minimum distance. Just pull the value out of the sort key in the search
results. (Note: it SHOULD be called "sort_mode" but is actually called
"mode" in released versions of ES. I've just fixed that in master)

See: gist:6596872 · GitHub

clint

On 17 September 2013 02:53, Nick Tackes ntackes@gmail.com wrote:

one other note. I cant sort by distance. I sort based on a custom
scoring algorithm that determines which clinical trials match a patients
condition.

On Monday, September 16, 2013 5:42:19 PM UTC-7, Nick Tackes wrote:

I have an index describing clinical trials. Often a clinical trial has
multiple locations that a patient can receive care at. Ideally, I would
like to compute the distance from a user's current geolocation to each of
the trial locations, so that I can display the distance to the closest
location pertaining to the trial.

I attempted to used a script_field in order to do this.
I created a gist that creates my simple index and populates some data and
then attempts to calculate the shortest distance from current location.
Any insight as to what I can do to resolve this issue is greatly
appreciated.

https://gist.github.com/**nicktackes/6588662https://gist.github.com/nicktackes/6588662

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.