I have a query that looks like this:
SELECT META().id FROM `data` USE INDEX (pending_suggestions USING GSI) WHERE META().id LIKE 'suggestion/%' AND $uid in friendIDs
friendIDs is an array of strings. I tried to speed up this query using this index
CREATE INDEX pending_suggestions ON data(friendIDs) WHERE (META().id LIKE 'suggestion/%') USING GSI
but it is still very slow (2s for a bucket of 200000 docs of which 20000 fulfill META().id LIKE ‘suggestion/’). Looking at the output of EXPLAIN, the index isn’t really used for the
AND $uid in friendIDs part of the query. Is there a way to index an array such that an IN query is faster?
Thank you in advance!