# Hard geo query

**URL:** <https://discuss.elastic.co/t/hard-geo-query/143196>\
**Category:** Elasticsearch\
**Created:** [August 6, 2018, 4:38pm UTC](https://discuss.elastic.co/t/hard-geo-query/143196 "2018-08-06T16:38:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![111126](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/111126/32/36818_2.png) [@111126](https://discuss.elastic.co/u/111126)\
**Post date:** [August 6, 2018, 4:38pm UTC](https://discuss.elastic.co/t/hard-geo-query/143196/1 "2018-08-06T16:38:07Z")

</div>

I have a GPS device, it moves around the country. It generates a large amount of data with coordinates that are sent and stored in the elastic. And I have a way points data (a static set of geo-coordinates). The GPS device can pass through the way points . I want to use one query to find all the points that appeared within a radius of 300 meters from the points of movement of my gps device. Please explain me by example how you can solve my problem?

Based on my research, I found the bad solution:  
I first find all the coordinates of my device (for example, all the coordinates in one day). This query returns me a very large number of geo coordinates. Then, with this request, [https://www.elastic.co/guide/en/elasticsearch/reference/6.1/query-dsl-geo-distance-query.html#\_lat\_lon\_as\_properties\_3](https://www.elastic.co/guide/en/elasticsearch/reference/6.1/query-dsl-geo-distance-query.html#_lat_lon_as_properties_3)  
I go through all the coordinates I found from the first query and look for a concrete wai points.  
This creates a high load on my cluster and does not look like the optimal solution.

---

<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:** [September 3, 2018, 4:47pm UTC](https://discuss.elastic.co/t/hard-geo-query/143196/2 "2018-09-03T16:47:07Z")

</div>

Closed on September 3, 2018, 4:47pm UTC

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