-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Hi,
I'm migrating an ES cluster from v1.7.5 to v5.1.2 and noticed that in v5.1.2 empy geo_point fields are being treated as if they were valid points with coordinates [-180, -90] within geo_xxx queries (used to work fine in v1.7.5). I'm trying to simply get the geo_bounds of my geo_point field to determine the area it covers. Previously I used "max" and "min" aggs on each coordinate (lat and lon) to accomplish this (this is just for our own ease of implementation) and now this is not even working (returns "null" for every coordinates max and min).
Has anyone experienced this? How do I get the geo_bounds without the empty points being considered? I've tried "bool" > "must" > "exists" without success.
Please see below some examples of what I just reported.
Mapping
"Location": {
"type": "geo_point"
},Data Samples
"Location": "-0.533218, 34.5575", << non-empty valid point
"Location": "", << empty invalid pointQuery
GET _search
{
"query": {
"bool" : {
"must" : {
"exists": { "field": "Location" }
}
}
},
"size": 0,
"aggs": {
"Location_bounds": {
"geo_bounds": {
"field": "Location"
}
},
"Location_lon_min": {
"min": {
"field": "Location.lon"
}
},
"Location_lon_max": {
"max": {
"field": "Location.lon"
}
},
"Location_lat_min": {
"min": {
"field": "Location.lat"
}
},
"Location_lat_max": {
"max": {
"field": "Location.lat"
}
}
}
}Query result
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 66000,
"max_score": 0,
"hits": []
},
"aggregations": {
"Location_lat_min": {
"value": null
},
"Location_lat_max": {
"value": null
},
"Location_lon_min": {
"value": null
},
"Location_lon_max": {
"value": null
},
"Location_bounds": {
"bounds": {
"top_left": {
"lat": 0.5858219834044576,
"lon": 34.09869999624789
},
"bottom_right": {
"lat": -90,
"lon": -180
}
}
}
}
}And I can confirm I have no geo_point in the [-180, -90] coordinate.
Thank you very much.