Details
-
Bug
-
Resolution: Fixed
-
Major
-
6.6.1, 6.5.0, Cheshire-Cat
-
1
Description
CREATE INDEX cx1 ON default(type, a1 ); |
|
UPSERT INTO default VALUES ("c001", {"type": "doc", "a1":[{"name":"a1"}, {"name":"a2"}]}), |
VALUES ("c002", {"type": "doc", "a1":[{"name":"b1"}, {"name":"a2"}]}), |
VALUES ("c003", {"type": "doc", "a1":[{"name":"b1"}, {"name":"a2"}]}); |
|
SELECT COUNT(1) FROM default AS d |
WHERE d.type = "doc" AND (EVERY v IN a1 SATISFIES v.name != "b1" END OR d.a1 IS MISSING); |
|
SELECT * FROM default AS d |
WHERE d.type = "doc" AND (EVERY v IN a1 SATISFIES v.name != "b1" END OR d.a1 IS MISSING); |
count query returns 3, non-count query returns 1
Index is not array Index. array field is Scalar value. count query can cover. But the EVERY predicate is not pushed to indexer. It should not push index aggregation.
Also note EVERY query can't push any index pushdowns.
Workaround:
SELECT COUNT(1) FROM default AS d WHERE d.type = "doc" AND (EVERY v IN IFMISSING(a1,[]) SATISFIES v.name != "b1" END);
EVERY is true for empty ARRAY.