# GIS Query not working on ES as expected

**URL:** https://discuss.elastic.co/t/gis-query-not-working-on-es-as-expected/21403
**Category:** Elasticsearch
**Created:** [December 26, 2014, 10:51pm UTC](https://discuss.elastic.co/t/gis-query-not-working-on-es-as-expected/21403 "2014-12-26T22:51:56Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![AndyGIS](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@AndyGIS](https://discuss.elastic.co/u/AndyGIS)
#### Post date: [December 26, 2014, 10:51pm UTC](https://discuss.elastic.co/t/gis-query-not-working-on-es-as-expected/21403/1 "2014-12-26T22:51:56Z")

</div>

Hi,  
I am new to GIS w/ ES.

Below is my request/ response. I am puzzled why do i get a polygon  
returned when it does not intersect w/ envelope defined in request. What  
am i missing? Appreciate quick response. Thanks,  
Andy

_Request_:

_\_search_  
{"size": 51000,"query": { "geo\_shape": { "POLYS": {"shape": {"type":  
"envelope", "coordinates": [_[-118.58, 35.32],[-118.68, 35.30]_]},  
"relation": "intersects"}}}}

_Response_:

"took" : 1172,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 94420,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_index" : "XXX",  
"\_type" : "XXX\_data",  
"\_id" : "1234",  
"\_score" : 1.0,  
"\_source":{"POLYS":{"type":"Polygon","coordinates":  
_[[[-117.7656797176,35.2420721325],[-117.766565557,35.2429646794],[-117.7675000712,35.2429532681],[-117.7661768866,35.2415486409],[-117.7661640858,35.2415341862],[-117.765523769,35.2419167046],[-117.7656797176,35.2420721325]_]]},  
"STATE": "XX", "ID": 1234 ,"COUNTY\_NAME": "YY"}]}  
}, {  
"\_index" : "XXX",  
"\_type" : "XXX\_data",  
"\_id" : "1235",  
"\_score" : 1.0,  
....  
....

\_mapping?pretty'

{  
"XXX" : {  
"mappings" : {  
"XXX\_data" : {  
"properties" : {  
"COUNTY\_NAME" : {  
"type" : "string"  
},  
"ID" : {  
"type" : "long"  
},  
"POLYS" : {  
"type" : "geo\_shape",  
"tree" : "quadtree",  
"tree\_levels" : 26  
},  
"STATE" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2d56bdd5-34a2-4066-a770-81dacb6be725%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2d56bdd5-34a2-4066-a770-81dacb6be725%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Peter\_Johnson\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/peter_johnson_2/32/8494_2.png) [@Peter\_Johnson\_2](https://discuss.elastic.co/u/Peter_Johnson_2)
#### Post date: [December 27, 2014, 2:40pm UTC](https://discuss.elastic.co/t/gis-query-not-working-on-es-as-expected/21403/2 "2014-12-27T14:40:44Z")

</div>

Hey Andy,

I tried to fix this but you're right, it seems to be a bug. I've attached a  
full bug report which you might want to add to a new github issue.

> <https://gist.github.com/anonymous/c250d602d1e7fe6d3655>

> <https://gist.github.com/missinglink/6e96f06e9e6032aa6416>

I also tried using 'geohash' instead of 'quadtree' with the same result.

-P

On Friday, 26 December 2014 22:51:56 UTC, AndyGIS wrote:

> Hi,  
> I am new to GIS w/ ES.
> 
> Below is my request/ response. I am puzzled why do i get a polygon  
> returned when it does not intersect w/ envelope defined in request. What  
> am i missing? Appreciate quick response. Thanks,  
> Andy
> 
> _Request_:
> 
> _\_search_  
> {"size": 51000,"query": { "geo\_shape": { "POLYS": {"shape": {"type":  
> "envelope", "coordinates": [_[-118.58, 35.32],[-118.68, 35.30]_]},  
> "relation": "intersects"}}}}
> 
> _Response_:
> 
> "took" : 1172,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 94420,  
> "max\_score" : 1.0,  
> "hits" : [ {  
> "\_index" : "XXX",  
> "\_type" : "XXX\_data",  
> "\_id" : "1234",  
> "\_score" : 1.0,  
> "\_source":{"POLYS":{"type":"Polygon","coordinates":  
> _[[[-117.7656797176,35.2420721325],[-117.766565557,35.2429646794],[-117.7675000712,35.2429532681],[-117.7661768866,35.2415486409],[-117.7661640858,35.2415341862],[-117.765523769,35.2419167046],[-117.7656797176,35.2420721325]_]]},  
> "STATE": "XX", "ID": 1234 ,"COUNTY\_NAME": "YY"}]}  
> }, {  
> "\_index" : "XXX",  
> "\_type" : "XXX\_data",  
> "\_id" : "1235",  
> "\_score" : 1.0,  
> ....  
> ....
> 
> \_mapping?pretty'
> 
> {  
> "XXX" : {  
> "mappings" : {  
> "XXX\_data" : {  
> "properties" : {  
> "COUNTY\_NAME" : {  
> "type" : "string"  
> },  
> "ID" : {  
> "type" : "long"  
> },  
> "POLYS" : {  
> "type" : "geo\_shape",  
> "tree" : "quadtree",  
> "tree\_levels" : 26  
> },  
> "STATE" : {  
> "type" : "string"  
> }  
> }  
> }  
> }  
> }  
> }

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f1c49b57-721d-4abd-bb1d-ac54631e543a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f1c49b57-721d-4abd-bb1d-ac54631e543a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![AndyGIS](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@AndyGIS](https://discuss.elastic.co/u/AndyGIS)
#### Post date: [December 28, 2014, 5:07am UTC](https://discuss.elastic.co/t/gis-query-not-working-on-es-as-expected/21403/3 "2014-12-28T05:07:50Z")

</div>

What i have is a simple test case for the feature (this is not a corner  
case)....Is this feature expected to work in some other coordinate system?  
Any workaround to overcome this bug? Thanks!  
Andy

On Saturday, December 27, 2014 6:40:44 AM UTC-8, Peter Johnson wrote:

> Hey Andy,
> 
> I tried to fix this but you're right, it seems to be a bug. I've attached  
> a full bug report which you might want to add to a new github issue.
> 
> [map.geojson · GitHub](https://gist.github.com/anonymous/c250d602d1e7fe6d3655)  
> [geo-intersects.sh · GitHub](https://gist.github.com/missinglink/6e96f06e9e6032aa6416)
> 
> I also tried using 'geohash' instead of 'quadtree' with the same result.
> 
> -P
> 
> On Friday, 26 December 2014 22:51:56 UTC, AndyGIS wrote:
> 
> > Hi,  
> > I am new to GIS w/ ES.
> > 
> > Below is my request/ response. I am puzzled why do i get a polygon  
> > returned when it does not intersect w/ envelope defined in request. What  
> > am i missing? Appreciate quick response. Thanks,  
> > Andy
> > 
> > _Request_:
> > 
> > _\_search_  
> > {"size": 51000,"query": { "geo\_shape": { "POLYS": {"shape": {"type":  
> > "envelope", "coordinates": [_[-118.58, 35.32],[-118.68, 35.30]_]},  
> > "relation": "intersects"}}}}
> > 
> > _Response_:
> > 
> > "took" : 1172,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 94420,  
> > "max\_score" : 1.0,  
> > "hits" : [ {  
> > "\_index" : "XXX",  
> > "\_type" : "XXX\_data",  
> > "\_id" : "1234",  
> > "\_score" : 1.0,  
> > "\_source":{"POLYS":{"type":"Polygon","coordinates":  
> > _[[[-117.7656797176,35.2420721325],[-117.766565557,35.2429646794],[-117.7675000712,35.2429532681],[-117.7661768866,35.2415486409],[-117.7661640858,35.2415341862],[-117.765523769,35.2419167046],[-117.7656797176,35.2420721325]_]]},  
> > "STATE": "XX", "ID": 1234 ,"COUNTY\_NAME": "YY"}]}  
> > }, {  
> > "\_index" : "XXX",  
> > "\_type" : "XXX\_data",  
> > "\_id" : "1235",  
> > "\_score" : 1.0,  
> > ....  
> > ....
> > 
> > \_mapping?pretty'
> > 
> > {  
> > "XXX" : {  
> > "mappings" : {  
> > "XXX\_data" : {  
> > "properties" : {  
> > "COUNTY\_NAME" : {  
> > "type" : "string"  
> > },  
> > "ID" : {  
> > "type" : "long"  
> > },  
> > "POLYS" : {  
> > "type" : "geo\_shape",  
> > "tree" : "quadtree",  
> > "tree\_levels" : 26  
> > },  
> > "STATE" : {  
> > "type" : "string"  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0c965f6b-a837-4f30-a4ea-cffaad3f92dd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0c965f6b-a837-4f30-a4ea-cffaad3f92dd%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![AndyGIS](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@AndyGIS](https://discuss.elastic.co/u/AndyGIS)
#### Post date: [December 28, 2014, 5:21am UTC](https://discuss.elastic.co/t/gis-query-not-working-on-es-as-expected/21403/4 "2014-12-28T05:21:07Z")

</div>

Filed [GIS Query not working on ES as expected · Issue #9079 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/9079)  
FYI!

On Saturday, December 27, 2014 9:07:50 PM UTC-8, AndyGIS wrote:

> What i have is a simple test case for the feature (this is not a corner  
> case)....Is this feature expected to work in some other coordinate system?  
> Any workaround to overcome this bug? Thanks!  
> Andy
> 
> On Saturday, December 27, 2014 6:40:44 AM UTC-8, Peter Johnson wrote:
> 
> > Hey Andy,
> > 
> > I tried to fix this but you're right, it seems to be a bug. I've attached  
> > a full bug report which you might want to add to a new github issue.
> > 
> > [map.geojson · GitHub](https://gist.github.com/anonymous/c250d602d1e7fe6d3655)  
> > [geo-intersects.sh · GitHub](https://gist.github.com/missinglink/6e96f06e9e6032aa6416)
> > 
> > I also tried using 'geohash' instead of 'quadtree' with the same result.
> > 
> > -P
> > 
> > On Friday, 26 December 2014 22:51:56 UTC, AndyGIS wrote:
> > 
> > > Hi,  
> > > I am new to GIS w/ ES.
> > > 
> > > Below is my request/ response. I am puzzled why do i get a polygon  
> > > returned when it does not intersect w/ envelope defined in request. What  
> > > am i missing? Appreciate quick response. Thanks,  
> > > Andy
> > > 
> > > _Request_:
> > > 
> > > _\_search_  
> > > {"size": 51000,"query": { "geo\_shape": { "POLYS": {"shape": {"type":  
> > > "envelope", "coordinates": [_[-118.58, 35.32],[-118.68, 35.30]_]},  
> > > "relation": "intersects"}}}}
> > > 
> > > _Response_:
> > > 
> > > "took" : 1172,  
> > > "timed\_out" : false,  
> > > "\_shards" : {  
> > > "total" : 5,  
> > > "successful" : 5,  
> > > "failed" : 0  
> > > },  
> > > "hits" : {  
> > > "total" : 94420,  
> > > "max\_score" : 1.0,  
> > > "hits" : [ {  
> > > "\_index" : "XXX",  
> > > "\_type" : "XXX\_data",  
> > > "\_id" : "1234",  
> > > "\_score" : 1.0,  
> > > "\_source":{"POLYS":{"type":"Polygon","coordinates":  
> > > _[[[-117.7656797176,35.2420721325],[-117.766565557,35.2429646794],[-117.7675000712,35.2429532681],[-117.7661768866,35.2415486409],[-117.7661640858,35.2415341862],[-117.765523769,35.2419167046],[-117.7656797176,35.2420721325]_]]},  
> > > "STATE": "XX", "ID": 1234 ,"COUNTY\_NAME": "YY"}]}  
> > > }, {  
> > > "\_index" : "XXX",  
> > > "\_type" : "XXX\_data",  
> > > "\_id" : "1235",  
> > > "\_score" : 1.0,  
> > > ....  
> > > ....
> > > 
> > > \_mapping?pretty'
> > > 
> > > {  
> > > "XXX" : {  
> > > "mappings" : {  
> > > "XXX\_data" : {  
> > > "properties" : {  
> > > "COUNTY\_NAME" : {  
> > > "type" : "string"  
> > > },  
> > > "ID" : {  
> > > "type" : "long"  
> > > },  
> > > "POLYS" : {  
> > > "type" : "geo\_shape",  
> > > "tree" : "quadtree",  
> > > "tree\_levels" : 26  
> > > },  
> > > "STATE" : {  
> > > "type" : "string"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d649783c-baa8-4f38-8d36-cc1e2f07d36e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d649783c-baa8-4f38-8d36-cc1e2f07d36e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Peter\_Johnson\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/peter_johnson_2/32/8494_2.png) [@Peter\_Johnson\_2](https://discuss.elastic.co/u/Peter_Johnson_2)
#### Post date: [December 28, 2014, 6:29pm UTC](https://discuss.elastic.co/t/gis-query-not-working-on-es-as-expected/21403/5 "2014-12-28T18:29:43Z")

</div>

I think I figured out what's going on, see the github issue.

-P

On Sunday, 28 December 2014 05:21:07 UTC, AndyGIS wrote:

> Filed [GIS Query not working on ES as expected · Issue #9079 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/9079)  
> FYI!
> 
> On Saturday, December 27, 2014 9:07:50 PM UTC-8, AndyGIS wrote:
> 
> > What i have is a simple test case for the feature (this is not a corner  
> > case)....Is this feature expected to work in some other coordinate system?  
> > Any workaround to overcome this bug? Thanks!  
> > Andy
> > 
> > On Saturday, December 27, 2014 6:40:44 AM UTC-8, Peter Johnson wrote:
> > 
> > > Hey Andy,
> > > 
> > > I tried to fix this but you're right, it seems to be a bug. I've  
> > > attached a full bug report which you might want to add to a new github  
> > > issue.
> > > 
> > > [map.geojson · GitHub](https://gist.github.com/anonymous/c250d602d1e7fe6d3655)  
> > > [geo-intersects.sh · GitHub](https://gist.github.com/missinglink/6e96f06e9e6032aa6416)
> > > 
> > > I also tried using 'geohash' instead of 'quadtree' with the same result.
> > > 
> > > -P
> > > 
> > > On Friday, 26 December 2014 22:51:56 UTC, AndyGIS wrote:
> > > 
> > > > Hi,  
> > > > I am new to GIS w/ ES.
> > > > 
> > > > Below is my request/ response. I am puzzled why do i get a polygon  
> > > > returned when it does not intersect w/ envelope defined in request. What  
> > > > am i missing? Appreciate quick response. Thanks,  
> > > > Andy
> > > > 
> > > > _Request_:
> > > > 
> > > > _\_search_  
> > > > {"size": 51000,"query": { "geo\_shape": { "POLYS": {"shape": {"type":  
> > > > "envelope", "coordinates": [_[-118.58, 35.32],[-118.68, 35.30]_]},  
> > > > "relation": "intersects"}}}}
> > > > 
> > > > _Response_:
> > > > 
> > > > "took" : 1172,  
> > > > "timed\_out" : false,  
> > > > "\_shards" : {  
> > > > "total" : 5,  
> > > > "successful" : 5,  
> > > > "failed" : 0  
> > > > },  
> > > > "hits" : {  
> > > > "total" : 94420,  
> > > > "max\_score" : 1.0,  
> > > > "hits" : [ {  
> > > > "\_index" : "XXX",  
> > > > "\_type" : "XXX\_data",  
> > > > "\_id" : "1234",  
> > > > "\_score" : 1.0,  
> > > > "\_source":{"POLYS":{"type":"Polygon","coordinates":  
> > > > _[[[-117.7656797176,35.2420721325],[-117.766565557,35.2429646794],[-117.7675000712,35.2429532681],[-117.7661768866,35.2415486409],[-117.7661640858,35.2415341862],[-117.765523769,35.2419167046],[-117.7656797176,35.2420721325]_]]},  
> > > > "STATE": "XX", "ID": 1234 ,"COUNTY\_NAME": "YY"}]}  
> > > > }, {  
> > > > "\_index" : "XXX",  
> > > > "\_type" : "XXX\_data",  
> > > > "\_id" : "1235",  
> > > > "\_score" : 1.0,  
> > > > ....  
> > > > ....
> > > > 
> > > > \_mapping?pretty'
> > > > 
> > > > {  
> > > > "XXX" : {  
> > > > "mappings" : {  
> > > > "XXX\_data" : {  
> > > > "properties" : {  
> > > > "COUNTY\_NAME" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "ID" : {  
> > > > "type" : "long"  
> > > > },  
> > > > "POLYS" : {  
> > > > "type" : "geo\_shape",  
> > > > "tree" : "quadtree",  
> > > > "tree\_levels" : 26  
> > > > },  
> > > > "STATE" : {  
> > > > "type" : "string"  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0b3a1d4f-7ad5-4163-947d-992a33b71ec7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b3a1d4f-7ad5-4163-947d-992a33b71ec7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![AndyGIS](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@AndyGIS](https://discuss.elastic.co/u/AndyGIS)
#### Post date: [December 30, 2014, 7:33am UTC](https://discuss.elastic.co/t/gis-query-not-working-on-es-as-expected/21403/6 "2014-12-30T07:33:52Z")

</div>

Thanks Peter. Issue at this point is resolved. I will upload about half a  
milion polygons and test further. Thanks for your help.

On Sun, Dec 28, 2014 at 10:29 AM, Peter Johnson [peter@missinglink.co.nz](mailto:peter@missinglink.co.nz)  
wrote:

> I think I figured out what's going on, see the github issue.
> 
> -P
> 
> On Sunday, 28 December 2014 05:21:07 UTC, AndyGIS wrote:
> 
> > Filed [GIS Query not working on ES as expected · Issue #9079 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/9079)  
> > FYI!
> > 
> > On Saturday, December 27, 2014 9:07:50 PM UTC-8, AndyGIS wrote:
> > 
> > > What i have is a simple test case for the feature (this is not a corner  
> > > case)....Is this feature expected to work in some other coordinate system?  
> > > Any workaround to overcome this bug? Thanks!  
> > > Andy
> > > 
> > > On Saturday, December 27, 2014 6:40:44 AM UTC-8, Peter Johnson wrote:
> > > 
> > > > Hey Andy,
> > > > 
> > > > I tried to fix this but you're right, it seems to be a bug. I've  
> > > > attached a full bug report which you might want to add to a new github  
> > > > issue.
> > > > 
> > > > [map.geojson · GitHub](https://gist.github.com/anonymous/c250d602d1e7fe6d3655)  
> > > > [geo-intersects.sh · GitHub](https://gist.github.com/missinglink/6e96f06e9e6032aa6416)
> > > > 
> > > > I also tried using 'geohash' instead of 'quadtree' with the same result.
> > > > 
> > > > -P
> > > > 
> > > > On Friday, 26 December 2014 22:51:56 UTC, AndyGIS wrote:
> > > > 
> > > > > Hi,  
> > > > > I am new to GIS w/ ES.
> > > > > 
> > > > > Below is my request/ response. I am puzzled why do i get a polygon  
> > > > > returned when it does not intersect w/ envelope defined in request. What  
> > > > > am i missing? Appreciate quick response. Thanks,  
> > > > > Andy
> > > > > 
> > > > > _Request_:
> > > > > 
> > > > > _\_search_  
> > > > > {"size": 51000,"query": { "geo\_shape": { "POLYS": {"shape": {"type":  
> > > > > "envelope", "coordinates": [_[-118.58, 35.32],[-118.68, 35.30]_]},  
> > > > > "relation": "intersects"}}}}
> > > > > 
> > > > > _Response_:
> > > > > 
> > > > > "took" : 1172,  
> > > > > "timed\_out" : false,  
> > > > > "\_shards" : {  
> > > > > "total" : 5,  
> > > > > "successful" : 5,  
> > > > > "failed" : 0  
> > > > > },  
> > > > > "hits" : {  
> > > > > "total" : 94420,  
> > > > > "max\_score" : 1.0,  
> > > > > "hits" : [ {  
> > > > > "\_index" : "XXX",  
> > > > > "\_type" : "XXX\_data",  
> > > > > "\_id" : "1234",  
> > > > > "\_score" : 1.0,  
> > > > > "\_source":{"POLYS":{"type":"Polygon","coordinates":_[[[-117.7656797176  
> > > > > \<7656797176\>,35.2420721325],[-117.766565557,35.2429646794],[-117.7675000712  
> > > > > \<7675000712\>,35.2429532681],[-117.7661768866,35.2415486409],[-117.7661640858,35.2415341862],[-117.765523769,35.2419167046],[-117.7656797176  
> > > > > \<7656797176\>,35.2420721325]_]]}, "STATE": "XX", "ID": 1234  
> > > > > ,"COUNTY\_NAME": "YY"}]}  
> > > > > }, {  
> > > > > "\_index" : "XXX",  
> > > > > "\_type" : "XXX\_data",  
> > > > > "\_id" : "1235",  
> > > > > "\_score" : 1.0,  
> > > > > ....  
> > > > > ....
> > > > > 
> > > > > \_mapping?pretty'
> > > > > 
> > > > > {  
> > > > > "XXX" : {  
> > > > > "mappings" : {  
> > > > > "XXX\_data" : {  
> > > > > "properties" : {  
> > > > > "COUNTY\_NAME" : {  
> > > > > "type" : "string"  
> > > > > },  
> > > > > "ID" : {  
> > > > > "type" : "long"  
> > > > > },  
> > > > > "POLYS" : {  
> > > > > "type" : "geo\_shape",  
> > > > > "tree" : "quadtree",  
> > > > > "tree\_levels" : 26  
> > > > > },  
> > > > > "STATE" : {  
> > > > > "type" : "string"  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit  
> > > > > [https://groups.google.com/d/topic/elasticsearch/AqVrhQ7UiG8/unsubscribe](https://groups.google.com/d/topic/elasticsearch/AqVrhQ7UiG8/unsubscribe).  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/0b3a1d4f-7ad5-4163-947d-992a33b71ec7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b3a1d4f-7ad5-4163-947d-992a33b71ec7%40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/0b3a1d4f-7ad5-4163-947d-992a33b71ec7%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b3a1d4f-7ad5-4163-947d-992a33b71ec7%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CADuvwZUUDq7CFgSONUaJOgvr6DNsr7zs8%3Dq0GJFC%2BxznBhr%2BTw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CADuvwZUUDq7CFgSONUaJOgvr6DNsr7zs8%3Dq0GJFC%2BxznBhr%2BTw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Peter\_Johnson\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/peter_johnson_2/32/8494_2.png) [@Peter\_Johnson\_2](https://discuss.elastic.co/u/Peter_Johnson_2)
#### Post date: [January 1, 2015, 2:34am UTC](https://discuss.elastic.co/t/gis-query-not-working-on-es-as-expected/21403/7 "2015-01-01T02:34:55Z")

</div>

Nice. Out of curiosity are the polygons ope ndata? If so could you share the source please?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/112d8bf5-ecb1-40dd-bac3-b9ec5276615b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/112d8bf5-ecb1-40dd-bac3-b9ec5276615b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:41am UTC](https://discuss.elastic.co/t/gis-query-not-working-on-es-as-expected/21403/8 "2017-07-06T00:41:19Z")

</div>


