Elasticsearch 8.15.2 is refusing to index a polygon which, as far as I can tell, is perfectly valid. Here is an image of the polygon on a map. Notice that it is just a trapezoid with nothing funny going on, and it does not cross the anti-meridian.
To reproduce, run the following cURL commands.
curl "localhost:9200/self_intersection?pretty" -X PUT --json '{
"mappings": {"properties": {"shape": {"type": "geo_shape"}}}
}'
curl "localhost:9200/self_intersection/_doc/?pretty" --json '{
"shape": {
"type": "Polygon",
"coordinates": [
[
[-30, 50],
[160, 50],
[160, 0],
[0, 0],
[-30, 50]
]
]
}
}'
curl -X DELETE "localhost:9200/self_intersection"
The second cURL call produces this error:
{
"error" : {
"root_cause" : [
{
"type" : "document_parsing_exception",
"reason" : "[13:5] failed to parse field [shape] of type [geo_shape]"
}
],
"type" : "document_parsing_exception",
"reason" : "[13:5] failed to parse field [shape] of type [geo_shape]",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "Polygon self-intersection at lat=24.24242424242424 lon=160.0"
}
},
"status" : 400
}
Is this a bug in Elasticsearch?