how geo_distance query works under the hood in Elasticsearch?

I need to use geo_distance query on Elasticsearch. Need info about how it works under the hood and what is latency? I am not able to find any doc relevant to this. please help

Hi @maulik_trapasiya Welcome to the community....

First with respect to latency, we can not tell you that as there are many factors... the size of your data set, the filters, the number of results within the distance, the HW profile etc.. etc... I would encourage you to do your own testing.

And you can look at the benchmarks here

https://elasticsearch-benchmarks.elastic.co/

I am not the Geo Expert but here is the code and it shows the simple calculations... there are planar and arc calculations.

and further here, I think the formulae are here

It looks like it follows the Haversine for the Arc distance method and the distance using a simple tangential plane for the planar distance, Whether this is precise enough for your use case is up to you perhaps you can provide further information if needed and we can take a deeper look.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.