How to index two keys of array element

I have a doc like this:

{ a, b: [ {x:.., y:.., z:...}, ...], c}

I need to query like
ANY _b in b satisfies _b.x = ‘foo’ and _b.y = ‘123’ END
ANY _b in b satisfies _b.x = ‘bar’ END

Please help.

I am building an index like
(distinct (array {_b.x, _b.y} for _b in b end))

Will update.

UPDATE: did not work, predicate not being pushed down into indexer

I’m not building an index like this:

(distinct (array [_b.x, _b.y] for _b in b end)

And will query like

any [_b.x, _b,.y] = [‘foo’, '123] for _b in b end
any [_b.x, _b.y][0] = ‘bar’ for _b in b end

I saw something like this in a forum thread I can’t easily find anymore. Will update.


This worked for the top most predicate:

any [_b.x, _b,.y] = [‘foo’, '123] for _b in b end

This will work for me.

Search forums SUCCESSOR you will get relevant posts

1 Like