No index available on keyspace that matches your query

Using latest CB server from docker hub: Enterprise Edition 6.0.0 build 1693 ‧

I have a simple document and index that I am trying to create, but each time I run a query I get the error “No index available on keyspace mybucket that matches your query.”

Document:

{
  "sampleValue": 78.0,
  "metricTypeKey": 6,
  "sampleTimeEpoch": 1544830299751,
  "type": "sample",
}

Index:

CREATE INDEX idx_query ON mybucket(sampleValue,metricTypeKey,sampleTimeEpoch) WHERE (type = “sample”)

Query:

select sampleValue, sampleTimeEpoch, metricTypeKey from mybucket where type='sample'

Not sure what I am doing wrong here. Seems like this query should be using the idx_query index.

You need to have predicate on leading index key.

select sampleValue, sampleTimeEpoch, metricTypeKey 
from mybucket 
where type='sample' AND sampleValue IS NOT MISSING;

Thanks, that did it.