We are having problems with a couchbase N1QL Query.
We have an index defined as follows:
CREATE INDEX `AppUser_SubjectId3` ON `Portal`(`SubjectId`) WHERE ((meta(self).`id`) like `AppUser%`)
We are then trying to run the following query:
SELECT RAW `Extent1`
FROM `Portal` as `Extent1`
USE INDEX (`AppUser_SubjectId3` USING GSI)
WHERE (`Extent1`.`SubjectId` = 'c8ea08231c3a985a06342355b87d6e2d6290a985d5c3592e5b8e5e5f14608a08')
And get the following error:
No index available on keyspace Portal that matches your query.
Use CREATE INDEX or CREATE PRIMARY INDEX to create an index,
or check that your expected index is online.
We have confirmed the obvious that the index is online. The only item worth noting is that the Bucket does not actually contain any documents at the moment, but we would not expect this error in this instance, simply nothing to be returned.
Any ideas?
EDIT:
I have created another index without the WHERE clause and it does not return the error any longer.
CREATE INDEX `AppUser_SubjectId4` ON `Portal`(`SubjectId`)
The only problem is that the WHERE clause is required!