Pushdown predicates on array indices

I have an index with with the key defined as

namespace(distinct( array x for x in myArray)) where …

and I’m query like

select meta(a).id from namespace a where … and any x in myArray sastisfies x.id = “…” end

I am hitting the index but my span has low=null and inclusion=0

I’m trying to pushdown the predicate am I doing something wrong or expecting too much.

I’m version 6 enterprise.

Please help.

You indexed x and query looking x.id, If you index as x.id the spans will reflect it.

You need namespace(distinct( array x.id for x in myArray)) where …
select meta(a).id from namespace a where … and any x in myArray sastisfies x.id = “…” end

Check out examples. https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/indexing-arrays.html

1 Like