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.
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.
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)
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.