I'm playing with Mango queries on a CouchDB 2.0 instance, through the fantastic pouchdb-find.
A few times I got the dreaded no matching index found, create an index to optimize query time
warning even though I was using indexed fields.
Just now I got it when selecting "type": {"$in": ["a", "b"]}
or the equivalent "$or": [{"type": "a"}, {"type": "b"}]
, even though an index on type
exists.
Googling (cloudant query docs, pouchdb-find docs, SO question) didn't help, and in the latter @nlawson says that some predicates ($ne
in the aforementioned question, but maybe my $in
/ $or
fall into the same basket?) "currently do not use any index".
- If I'm indeed in the same boat, what does that mean? Is the impossibility to use indexes on queries using certain predicates a limitation of the mango backend, or a pouchdb one?
- Am I doing something wrong / is there an index workaround to avoid this?
- More generally, is there documentation I could read to get a deeper grip on how indexes work and how to troubleshoot them?
Thanks!