Additional help with N1QL dynamic attribute key

Hi @m0thra,

I filed a bug because your original query should work: https://issues.couchbase.com/browse/MB-21720

Here is a workaround for 4.5.1. This will give you the equivalent of AND, and will use your index. Confirm index usage by using EXPLAIN, and check that both arms of the INTERSECT use the index.

SELECT r AS doc, meta(r).cas AS revision
FROM record AS r
WHERE ANY i IN OBJECT_PAIRS( indexMap ) SATISFIES i = { "name":"key1", "value":"val1" } END
INTERSECT
SELECT r AS doc, meta(r).cas AS revision
FROM record AS r
WHERE ANY i IN OBJECT_PAIRS( indexMap ) SATISFIES i = { "name":"key2", "value":"val2" } END
LIMIT 100;