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


(Luke) #1

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.


(system) #2