# How elasticsearch index Geo-points?

**URL:** <https://discuss.elastic.co/t/how-elasticsearch-index-geo-points/288813>\
**Category:** Elasticsearch\
**Created:** [November 9, 2021, 7:19pm UTC](https://discuss.elastic.co/t/how-elasticsearch-index-geo-points/288813 "2021-11-09T19:19:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehsan\_kabiri\_33](https://avatars.discourse-cdn.com/v4/letter/e/b77776/32.png) [@ehsan\_kabiri\_33](https://discuss.elastic.co/u/ehsan_kabiri_33)\
**Post date:** [November 9, 2021, 7:19pm UTC](https://discuss.elastic.co/t/how-elasticsearch-index-geo-points/288813/1 "2021-11-09T19:19:31Z")

</div>

I can't imagine how Elasteicsearch index Geo-points.  
Suppose I have 1 million records/documents in my table/index and each document has a geo point (Lat/Lon).  
In sql , if I want to find the 10 nearest docs, I need to check all 1 million docs and get all the distnces between my current location and the points in my table, and then sort/extract the nearset places . (distance = sqrt ( x^2 + y^2) and this should be done 1 million times)

But in Elasticsearch it is done so fast !! I know that's impossible to calculate all distances and compare them at times less than 50 milli seconds (according to my current hardware) !!

So , I need to know what is the mechanism of Elasticsearch in indexing Geo points ? That it can find and compare distances so fast?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 7, 2021, 7:20pm UTC](https://discuss.elastic.co/t/how-elasticsearch-index-geo-points/288813/2 "2021-12-07T19:20:17Z")

</div>

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