# Slow geo\_shape filter

**URL:** <https://discuss.elastic.co/t/slow-geo-shape-filter/12128>\
**Category:** Elasticsearch\
**Created:** [May 26, 2013, 2:33pm UTC](https://discuss.elastic.co/t/slow-geo-shape-filter/12128 "2013-05-26T14:33:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Sturm](https://avatars.discourse-cdn.com/v4/letter/c/e47774/32.png) [@Christian\_Sturm](https://discuss.elastic.co/u/Christian_Sturm)\
**Post date:** [May 26, 2013, 2:33pm UTC](https://discuss.elastic.co/t/slow-geo-shape-filter/12128/1 "2013-05-26T14:33:01Z")

</div>

Hello,

I have a set of about 250,000 polygons. Each of them contains a field  
called geo, containing a geo\_shape value (polygons). Querying against it  
using a construct like this:

{  
"fields": [],  
"query": {  
"match\_all": {}  
},  
"filter": {  
"geo\_shape": {  
"geo": {  
"shape": {  
"type": "Polygon",  
"coordinates": [  
... Points ...  
]  
}  
}  
}  
}  
}

causes a query time of multiple seconds. I tried using both quad trees and  
geohashes. I am querying for estates using polygons of streets, districts,  
etc. Is there a way to speed up my query?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jilles\_van\_Gurp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jilles_van_gurp/32/879_2.png) [@Jilles\_van\_Gurp](https://discuss.elastic.co/u/Jilles_van_Gurp)\
**Post date:** [May 27, 2013, 8:14am UTC](https://discuss.elastic.co/t/slow-geo-shape-filter/12128/2 "2013-05-27T08:14:43Z")

</div>

Assuming you are using 0.90, try to reduce the precision or tree\_levels in  
the mapping for the field to a few hundred meters.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

If you aren't using 0.90, you should upgrade because that release contains  
several geo\_shape related fixes.

I have a similar data set (flickr neighborhood polygons) of about over 200K  
shapes of varying sizes. Especially things like continents and other large  
polygons are very hard on the index. I basically use several types with  
different precision/tree\_levels. For things like countries, I don't need a  
lot of accuracy.

Jilles

On Sunday, May 26, 2013 4:33:01 PM UTC+2, Christian Sturm wrote:

> Hello,
> 
> I have a set of about 250,000 polygons. Each of them contains a field  
> called geo, containing a geo\_shape value (polygons). Querying against it  
> using a construct like this:
> 
> {  
> "fields": ,  
> "query": {  
> "match\_all": {}  
> },  
> "filter": {  
> "geo\_shape": {  
> "geo": {  
> "shape": {  
> "type": "Polygon",  
> "coordinates": [  
> ... Points ...  
> ]  
> }  
> }  
> }  
> }  
> }
> 
> causes a query time of multiple seconds. I tried using both quad trees and  
> geohashes. I am querying for estates using polygons of streets, districts,  
> etc. Is there a way to speed up my query?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:34am UTC](https://discuss.elastic.co/t/slow-geo-shape-filter/12128/3 "2017-07-06T02:34:38Z")

</div>


