GeoShape Polygon Query not returning expected documents

Summary

GeoShape Polygon Query not returning expected documents that suspect are within the polygon; but am aware it maybe related to crossing the International Date Line.

My environment details below

Kibana version: 8.14.3

Elasticsearch version: 8.14.3

Server OS version: Windows 11 Enterprise

Steps to reproduce:

  1. Index a document with a geopoint property that is within the UK, in my case I have
"metadata": {
    "mapLocations": [
        {
            "lon": -1.865,
            "lat": 53.811
        }
    ]
}

with the following mapping:

"metadata": {
    ...,
    "mapLocations": {
        "type": "geo_point"
     }
}
  1. Query the index in kibana with the following query that uses geo_shape of type polygon with counter clockwise coordinates from geoJSON object with the intersect relation
GET test_index/_search
{
  "query": {
    "geo_shape": {
      "metadata.mapLocations": {
        "shape": {
          "type": "Polygon",
          "orientation": "RIGHT",
          "coordinates": [
            [
              [
                -283.359375,
                -87.599705
              ],
              [
                984.375,
                -87.599705
              ],
              [
                984.375,
                86.574207
              ],
              [
                -283.359375,
                86.574207
              ],
              [
                -283.359375,
                -87.599705
              ]
            ]
          ]
        },
        "relation": "intersects"
      }
    }
  }
}

Expected behavior: Although the rectangle shaped polygon has a large longitude range than -180 to 180 I still expect it to return the document as it is within the given range.

Screenshots (if relevant): There is nothing to show as I get no hits but if I input the above geoJSON into the Analytics > Map within Kibana it seems to show the expected shape that overlaps longitudinally which makes me think it should find the document as it seems to suggest the shape is valid

I suspected initially that the above issue might be the anti-meridian problem since it crossed the International Date Line but I have other polygons that also cross this line but the query seems to return the expected matches.

For example this query works as expected

GET test_index/_search
{
  "query": {
    "geo_shape": {
      "metadata.mapLocations": {
        "shape": {
          "type": "Polygon",
          "orientation": "RIGHT",
          "coordinates": [
            [
              [
                -200,
                -90
              ],
              [
                900,
                -90
              ],
              [
                900,
                90
              ],
              [
                -200,
                90
              ],
              [
                -200,
                -90
              ]
            ]
          ]
        },
        "relation": "intersects"
      }
    }
  }
}

Although I appreciate it could still be related to the IDL

I think you are displaying the geometry by uploading the geojson directly which is not normalizing the coordinates. In order to check how Elasticsearch is interpreting the geometry, the best thing is to index it:

PUT /test
{
  "mappings": {
    "dynamic": "strict",
    "properties": {
      "location": {
        "type": "geo_shape"
      }
    }
  }
}


POST test/_doc
{
  "location": {
    "type": "Polygon",
    "orientation": "RIGHT",
    "coordinates": [
      [
        [
          -283.359375,
          -87.599705
        ],
        [
          984.375,
          -87.599705
        ],
        [
          984.375,
          86.574207
        ],
        [
          -283.359375,
          86.574207
        ],
        [
          -283.359375,
          -87.599705
        ]
      ]
    ]
  }
}

Then you can use the maps application inside kibana and the documents layer to look at the geometry: