Query Couchbase Server

I want to query couchbase server and find out the total number of documents with no "type " field present

This requires Primary index

SELECT COUNT(1) AS cnt
FROM <bucketname>
WHERE type IS MISSING;

OR

CREATE INDEX ix1 ON <bucketname>(META().id) WHERE type IS MISSING;
SELECT COUNT(1) AS cnt
FROM <bucketname>
WHERE type IS MISSING AND META().id > "";