# Query ES API for a Geofence Containing Most Docs

**URL:** <https://discuss.elastic.co/t/query-es-api-for-a-geofence-containing-most-docs/105303>\
**Category:** Elasticsearch\
**Created:** [October 25, 2017, 9:35pm UTC](https://discuss.elastic.co/t/query-es-api-for-a-geofence-containing-most-docs/105303 "2017-10-25T21:35:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seth.yes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seth.yes/32/11788_2.png) [@seth.yes](https://discuss.elastic.co/u/seth.yes)\
**Post date:** [October 25, 2017, 9:35pm UTC](https://discuss.elastic.co/t/query-es-api-for-a-geofence-containing-most-docs/105303/1 "2017-10-25T21:35:14Z")

</div>

ES v5.6.2

I have a use case where I need to determine a geofence containing a large numbers of requests. It would be nice to get any geofence with \>10% of requests, however this ask is flexible depending on what's possible..

Is there a good way to query ES for a geofence with something similar to the following filters:

- geofence no larger than 10km x 10km
- ordered by largest number of requests
- a few filters I know how to set; e.g. `Nginx-Response.keyword: 'Miss'`, last 4 hours, etc..

I'm seeing many options to return data via the ES API, however I'm not seeing anything regarding ES returning a geofence back.. curious if this is possible, being developed, or not on the development roadmap at this point..

---

<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:** [November 22, 2017, 9:35pm UTC](https://discuss.elastic.co/t/query-es-api-for-a-geofence-containing-most-docs/105303/2 "2017-11-22T21:35:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kent\_Marten](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kent_marten/32/69653_2.png) [@Kent\_Marten](https://discuss.elastic.co/u/Kent_Marten)\
**Post date:** [July 9, 2020, 9:35pm UTC](https://discuss.elastic.co/t/query-es-api-for-a-geofence-containing-most-docs/105303/3 "2020-07-09T21:35:44Z")

</div>

Hi @seth.yes,

I realize you posted this 3 years ago. I just joined Elastic as the PM for Maps in Kibana. I am curious to know if you ever solved this problem?

Best,  
Kent M.
