Skip to content

Orientation of geo_shapes is ignored #35813

@iverase

Description

@iverase

It seems the setting orientation for geo_shape has no effect. Here is an example:

PUT geoshape
{
  "settings":{
    "number_of_shards": 1,
    "number_of_replicas": 0
  }
}

GET geoshape/_mapping

PUT geoshape/_mapping/_doc
{
  "properties": {
    "geometry": {
      "type": "geo_shape",
      "orientation": "ccw"
    }
  }
}

PUT geoshape/_doc/1/
{
  "geometry":"POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))" 
}

PUT geoshape/_doc/2/
{
  "geometry":"POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))" 
}

GET geoshape/_search

GET geoshape/_search
{
    "query":{
        "bool": {
            "must": {
                "match_all": {}
            },
            "filter": {
                "geo_shape": {
                    "geometry": {
                        "shape": {
                            "type": "point",
                            "coordinates" : [0.5, 0.5]
                        },
                        "relation": "intersects"
                    }
                }
            }
        }
    }
}

answer:

{
  "took": 2,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 2,
    "max_score": 1,
    "hits": [
      {
        "_index": "geoshape",
        "_type": "_doc",
        "_id": "1",
        "_score": 1,
        "_source": {
          "geometry": "POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"
        }
      },
      {
        "_index": "geoshape",
        "_type": "_doc",
        "_id": "2",
        "_score": 1,
        "_source": {
          "geometry": "POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))"
        }
      }
    ]
  }
}

My expectations are that those polygons are different and mutually exclusive, but they seem to represent the same polygon regardless of the order of the vertices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Analytics/GeoIndexing, search aggregations of geo points and shapes>non-issueTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions