Difference between GeoShape query with WKT/geojson

Hi,

I was wondering that if I’m storing spatial data in geojson format in opensearch. And querying it using geo shape query but rather than providing geojson format to the query I’m providing shape in WKT format, will it have any impact on the query? Like will it work as expected or will return wrong result.

I’ve tried this with some sample data and it works as expected but still want to ensure that it will work perfectly or might cause some issue.

Here’s the code:

PUT test-index
{
  "mappings": {
    "properties": {
      "geometry": {
        "type": "geo_shape"
      }
    }
  }
}

# Index some documents.
POST test-index/_doc/1
{
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          88.76953125,
          39.095962936305476
        ],
        [
          83.49609375,
          36.03133177633187
        ],
        [
          82.705078125,
          32.47269502206151
        ],
        [
          91.40625,
          29.611670115197377
        ],
        [
          95.712890625,
          35.38904996691167
        ],
        [
          88.76953125,
          39.095962936305476
        ]
      ]
    ]
  }
}

POST test-index/_doc/2
{
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          106.875,
          47.100044694025215
        ],
        [
          100.37109375,
          44.465151013519616
        ],
        [
          105.99609375,
          38.47939467327645
        ],
        [
          114.521484375,
          42.94033923363181
        ],
        [
          112.236328125,
          49.210420445650286
        ],
        [
          106.875,
          47.100044694025215
        ]
      ]
    ]
  }
}

# Query documents based on geometry, provided in geojson format.
GET test-index/_search
{
  "query": {
    "geo_shape": {
      "geometry": {
        "shape": {
          "type": "Polygon",
          "coordinates": [
            [
              [
                99.140625,
                36.03133177633187
              ],
              [
                91.93359375,
                35.31736632923788
              ],
              [
                100.37109375,
                33.284619968887675
              ],
              [
                106.61132812499999,
                37.78808138412046
              ],
              [
                106.61132812499999,
                39.57182223734374
              ],
              [
                99.140625,
                36.03133177633187
              ]
            ]
          ]
        },
        "relation": "intersects"
      }
    }
  }
}

# Query using WKT.
GET test-index/_search
{
  "query": {
    "geo_shape": {
      "geometry": {
        "shape": "POLYGON ((99.140625 36.03133177633187, 91.93359375 35.31736632923788, 100.37109375 33.284619968887675, 106.61132812499999 37.78808138412046, 106.61132812499999 39.57182223734374, 99.140625 36.03133177633187))",
        "relation": "intersects"
      }
    }
  }
}

Both queries returned the correct documents.