ElasticSearch 7.16.3 throwing error on shape that is valid geojson


We recently upgraded from ES version 6 to 7.16.3. One of the shapes we have in our index worked fine in version 6 and is currently working fine in version 7 in the index we migrated over from 6, but when trying to recreate the index in version 7, it throws an "invalid_shape_exception" exception on one of the shapes.

This shape is a very narrow polygon wedge. It was the result of public land parcel data that was originally a linestring that ended up getting buffered into a polygon. It indexed fine in the last version of Elasticsearch and when I test the geojson in online viewers, it displays it just fine. See below for details on how to recreate.

Search Index Settings:

PUT http://ServerName:PortNumber/test_index?include_type_name=true
  "settings": {
    "index": {
      "codec": "best_compression"
    "number_of_shards": 10,
    "number_of_replicas": 0,
    "refresh_interval": -1
  "mappings": {
    "datasetitems": {
      "properties": {
        "geography": {
          "type": "geo_shape",
          "tree": "quadtree",
          "precision": "50.0m"

Post that returns error:

POST http://ServerName:PortNumber/_bulk
{ "create": { "_index" : "test_index", "_type" : "datasetitems", "_id": 1 } }

Error I receive:

"error": {
	"type": "mapper_parsing_exception",
	"reason": "failed to parse",
	"caused_by": {
		"type": "invalid_shape_exception",
		"reason": "Cannot determine orientation: signed area equal to 0"

We changed the way we compute the orientation of a polygon as the previous computation would fail with some topologies. Unfortunately the new computation is less sensitive to small [polygons. I had a look and I think we can do better, would you mind opening a bug report in the Elasticsearch repo?

In addition I have noticed you are still using the deprecated prefix tree indexing approach (by setting tree and precision). I strongly recommend you to move to the BKD tree indexing approach as prefix tree will not be supported in future versions.

Thank you. I just submitted a ticket. And yes, we are aware the prefix tree is deprecated and going away. We are planning on doing an upgrade to version 8 in the future, but did not do so yet because of the major performance loss we experienced when going away from the prefix tree.

We just caught up to version 7, so I assume we will upgrade and do more testing with version 8 in a few months.

Thanks for the insight into what caused the issue. I'll keep an eye on my bug ticket.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.