# Querying envelope spanning date line gives different results than querying corresponding polygon

**URL:** <https://discuss.elastic.co/t/querying-envelope-spanning-date-line-gives-different-results-than-querying-corresponding-polygon/36580>\
**Category:** Elasticsearch\
**Created:** [December 7, 2015, 10:29pm UTC](https://discuss.elastic.co/t/querying-envelope-spanning-date-line-gives-different-results-than-querying-corresponding-polygon/36580 "2015-12-07T22:29:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luke\_smoron](https://avatars.discourse-cdn.com/v4/letter/l/f14d63/32.png) [@luke\_smoron](https://discuss.elastic.co/u/luke_smoron)\
**Post date:** [December 7, 2015, 10:29pm UTC](https://discuss.elastic.co/t/querying-envelope-spanning-date-line-gives-different-results-than-querying-corresponding-polygon/36580/1 "2015-12-07T22:29:57Z")

</div>

I am using elastic 2.1.0. with following geo mapping  
PRIMARY\_GEOMETRY\_JSON: {  
type: "geo\_shape",  
tree: "quadtree",  
tree\_levels: 0,  
precision: "100.0m",  
strategy: "recursive",  
distance\_error\_pct: 0.1,  
orientation: "LEFT",  
points\_only: false,  
coerce: false  
}

when I query for test shape: {  
"type": "LineString",  
"coordinates": [  
[  
175.75806180015206,  
-39.452619545753954  
],  
[  
173.03345242515206,  
-42.04877180047536  
]  
]  
}

using polygon query:  
{

"from" : 0,  
"size" : 20,  
"query" : {  
"bool" : {  
"must" : {  
"match\_all" : { }  
},  
"filter" : {  
"bool" : {  
"must" : [ {  
"geo\_shape" : {  
"PRIMARY\_GEOMETRY\_JSON" : {  
"shape" : {"type": "Polygon",  
"coordinates" : [ [  
[165.881826171875, -35.984370105748795],  
[165.881826171875, -46.01768541307848] ,  
[-158.466552734375, -46.01768541307848],  
[-158.466552734375, -35.984370105748795],  
[165.881826171875, -35.984370105748795]  
]]  
},  
"relation" : "intersects"  
},  
"\_name" : null  
}  
} ]  
}  
}  
}  
}  
}  
I get correct response but If try to run Envelope query  
{  
"fields":"ASSET\_ID",  
"from" : 0,  
"size" : 20,  
"query" : {  
"bool" : {  
"must" : {  
"match\_all" : { }  
},  
"filter" : {  
"bool" : {  
"must" : [ {  
"geo\_shape" : {  
"PRIMARY\_GEOMETRY\_JSON" : {  
"shape" :{  
"type" : "envelope",  
"coordinates" : [[ 165.871826171875, -35.984370105748795], [-158.466552734375, -46.01768541307848] ]  
},  
"relation" : "intersects"  
},  
"\_name" : null  
}  
} ]  
}  
}  
}  
},  
"sort" : [ {  
"ASSET\_ID" : {  
"order" : "asc",  
"missing" : "\_last"  
}  
} ]  
}

I get no results.

---

<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 5, 2017, 11:32pm UTC](https://discuss.elastic.co/t/querying-envelope-spanning-date-line-gives-different-results-than-querying-corresponding-polygon/36580/2 "2017-07-05T23:32:57Z")

</div>


