Calculating distance when retrieving a single doc


(Gaurav Arora) #1

I have documents saved in my ES instance which contain coords. Retrieving the distance when performing searches is easy using _geo_distance sort and I am currently doing that but I would also like ES to calculate the distance when I retrieve a single document.

Is this possible to do? My primary reason for doing this is that I would not like to put the calculation logic in my code because ES already does this well.


(Mark Walkom) #2

The distance from what though?


(Gaurav Arora) #3

Apologies for the late reply. I will pass in the coords from where the distance is to be calculated.


(system) #4