This query is saying check every document and report the type field, including documents that do not have the type field. As a result the index can’t be used as it only contains information about documents that have the type field.
Instead I suspect the query that should be used is
SELECT DISTINCT type FROM default WHERE type IS NOT MISSING;
In this case it will report the list of type fields for all documents that has a type field, which means the index can then be used.
Couchbase GSI index only index the documents whose leading index key is NOT MISSING. If the leading index key is MISSING in the document those documents are not indexed. So both indexes have same disk foot print.
Select distinct type from test;
Above query must give the entry when type is MISSING, index doesn’t have that info due to that index has not chosen ( Index qualifies only when it has all the information. with out that result in wrong results and index will not be chosen).