Aproximates the number of distinct keys in a view index using a variant of the HyperLogLog algorithm. This algorithm enables an efficient, parallelizable computation of cardinality using fixed memory resources. CouchDB has configured the underlying data structure to have a relative error of ~2%.
Hi @socketman2016, sorry for the delay. You can emit the key whose distinct value you want and then use reduce _count. While querying you can use group_level till which you want the distinct value and count the number of rows returned.
You can check this forum post which is similar to this