Global Secondary Index not Working without Creating Primary Index

Hi

I m Creating Global secondary Indexes On some key of my document .
The index gets created and is visible on Indexes UI as ready but when I’m trying on query it shows No index is created.

Is it Possible to have secondary index working without creating Primary index?

Post Index definition and query. Queries can work with secondary index alone without primary index. If the query can’t use secondary index and no primary index it will return error.

Create INDEX i1 ON ErrorLogs1(a1);

SELECT a2 FROM ErrorLogs1 USE INDEX (i1);

log:

[
{
“code”: 4000,
“msg”: “No index available on keyspace ErrorLogs1 that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online.”,
“query_from_user”: “SELECT a2 FROM ErrorLogs1 USE INDEX (i1);”
}
]

Index selection is depends on WHERE clause. Try this

SELECT a2 FROM ErrorLogs1 USE INDEX (i1) WHERE a1 IS NOT MISSING;

Also check this out https://blog.couchbase.com/n1ql-practical-guide/

So this means it is mandatory to use where clause when using Secondary Indexes?

Yes. This link has useful info https://blog.couchbase.com/n1ql-practical-guide/

Thanks will definitely look into it.