Example document:
“spot”: {
“conv_owner_id”: 244,
“conv_recipients”: [
227,
6
],
“type”: “conversation”
}
Index:
CREATE INDEX idx_1
ON spots
(conv_owner_id
, DISTINCT ARRAY r FOR r IN conv_recipients
END)
WHERE (type
= “conversation”)
Query:
SELECT *
FROM spots
WHERE type = ‘conversation’
AND (
conv_owner_id
= 6
OR ANY r IN conv_recipients
SATISFIES r=6 END
)
I cannot get the query to use the aforementioned index.
When one of the document elements (ie. conv_owner_id
or conv_recipients
) are used in index and query respectively, the index is used. But when used combined in the index and query, they are not!