Proper way to get count

select count(1) from data where type_=“TransactionDetail” and type_ is not missing and type = “APPROVE” and type is not missing;

This query getting time out. I already created index on type_ and type.

create index ix1 on data(type) where  type_=“TransactionDetail”;
select count(1) from data where type_=“TransactionDetail”  and type = “APPROVE” ;

Also checkout EE feature https://blog.couchbase.com/understanding-index-grouping-aggregation-couchbase-n1ql-query/