# Documents with geo polygon

**URL:** <https://discuss.elastic.co/t/documents-with-geo-polygon/7572>\
**Category:** Elasticsearch\
**Created:** [May 6, 2012, 2:09am UTC](https://discuss.elastic.co/t/documents-with-geo-polygon/7572 "2012-05-06T02:09:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felix\_3](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Felix\_3](https://discuss.elastic.co/u/Felix_3)\
**Post date:** [May 6, 2012, 2:09am UTC](https://discuss.elastic.co/t/documents-with-geo-polygon/7572/1 "2012-05-06T02:09:03Z")

</div>

Hi all,

I am pretty new to elasticsearch and would like to know how to add  
documents to be indexed with geo spatial features of a polygon and be  
able to search for all documents that is covered by another polygon.  
For example, how do I add a document like this to be indexed.  
{"Title": "lake", "loc":{"polygon":[12,24],[21,32],[26, 44],[22,38],  
[15 29] }}

when this document is added to the index, how do I search for it when  
another polygon is given.

Thanks,

Felix

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 9, 2012, 8:53am UTC](https://discuss.elastic.co/t/documents-with-geo-polygon/7572/2 "2012-05-09T08:53:27Z")

</div>

There is only support for single geo points, not polygons to index, on  
those single geo points, you can do distance, bounding box, and polygon.

On Sun, May 6, 2012 at 5:09 AM, Felix [guohangao@gmail.com](mailto:guohangao@gmail.com) wrote:

> Hi all,
> 
> I am pretty new to elasticsearch and would like to know how to add  
> documents to be indexed with geo spatial features of a polygon and be  
> able to search for all documents that is covered by another polygon.  
> For example, how do I add a document like this to be indexed.  
> {"Title": "lake", "loc":{"polygon":[12,24],[21,32],[26, 44],[22,38],  
> [15 29] }}
> 
> when this document is added to the index, how do I search for it when  
> another polygon is given.
> 
> Thanks,
> 
> Felix

---

<div class="post-metadata">

**Author:** ![oakstream](https://avatars.discourse-cdn.com/v4/letter/o/b38774/32.png) [@oakstream](https://discuss.elastic.co/u/oakstream)\
**Post date:** [January 28, 2013, 1:13pm UTC](https://discuss.elastic.co/t/documents-with-geo-polygon/7572/3 "2013-01-28T13:13:45Z")

</div>

Hello, I was wondering with the latest release of ES does it support Polygon indexes now? I was reading that Lucene 4.0 seemed to support it with JTS extensions. Do you know if this is the case with ES?

---

<div class="post-metadata">

**Author:** ![oakstream](https://avatars.discourse-cdn.com/v4/letter/o/b38774/32.png) [@oakstream](https://discuss.elastic.co/u/oakstream)\
**Post date:** [January 28, 2013, 1:29pm UTC](https://discuss.elastic.co/t/documents-with-geo-polygon/7572/4 "2013-01-28T13:29:59Z")

</div>

I think i might of found my answer  
[http://www.elasticsearch.org/guide/reference/mapping/geo-shape-type.html](http://www.elasticsearch.org/guide/reference/mapping/geo-shape-type.html)

Does anyone have any experience with the accuracy of these queries? Would it compare to say an oracle or postgres polygon query? I'm interested in Point in Polygon accuracy as well as polygon in polygon search.

Thanks

---

<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:** [July 6, 2017, 2:54am UTC](https://discuss.elastic.co/t/documents-with-geo-polygon/7572/5 "2017-07-06T02:54:24Z")

</div>


