I have a requirement of finding the total number of documents while performing a query without fetching them in cloudant.
I'm using the cloudant client https://github.com/cloudant/java-cloudant . Generally to fetch documents I use "findByIndex()" method.
Now my requirement is to get "only" the total count of documents that can fetched by the selector that is specified in first argument of findByIndex().
I don't want to fetch all the documents and count them on the client side as that will take up all the network bandwidth and the memory.
From the search I do see its possible via the reduce function given here: http://guide.couchdb.org/editions/1/en/cookbook.html#aggregate
But how do I use this reduce function on the java client for cloudant? Is there some other way to achieve this?