For cartesian multi-value points, the lucene pushdown for ST_WITHIN acts like ST_INTERSECTS in that it returns true if ANY of the points intersect the test geometry, instead of requiring ALL points to intersect the test geometry.
The latter simply creates explicit tests of single and multivalued points, where it is clear which are merely intersecting or entirely within the test polygon. This works fine for geo_point, but fails for cartesian_point with multi-values where the points are partially within the polygon.
The issue at https://github.com/elastic/elasticsearch/issues/110830 describes how Lucene pushdown for spatial predicates does not match the compute engine results. This is mostly because we support multi-values in Lucene pushdown, but not in the compute engine. The fix at https://github.com/elastic/elasticsearch/pull/112063 enabled multi-value support in the compute engine, but exposes an additional bug.
For cartesian multi-value points, the lucene pushdown for
ST_WITHIN
acts likeST_INTERSECTS
in that it returnstrue
ifANY
of the points intersect the test geometry, instead of requiringALL
points to intersect the test geometry.To reproduce this we have failing tests:
SpatialPushDownCartesianPointIT.testPushedDownQueriesMultiValue()
SpatialPushDownCartesianPointIT.testSimplePointInPolygon()
The latter simply creates explicit tests of single and multivalued points, where it is clear which are merely intersecting or entirely within the test polygon. This works fine for
geo_point
, but fails forcartesian_point
with multi-values where the points are partially within the polygon.