Strange behavior with paginated query


I get a strange behavior with paginated query. While I paginate on the result set, I get duplicates of some documents. I’m doing the following in my code:

// force start indexing of view query.setStale(Stale.FALSE); query.setReduce(true); ViewResponse respFromReduce = client.query(view, query); String expectedCountFromScroll = null; for (ViewRow viewRow : respFromReduce) { expectedCountFromScroll = viewRow.getValue(); } query.setReduce(false); query.setIncludeDocs(false); //disable indexing of view from sdk query.setStale(Stale.OK); Paginator scroll = client.paginatedQuery(view, query, SCROLL_SIZE); int docsFromScrollCnt = 0; while (scroll.hasNext()) { ViewResponse response =; docsFromScrollCnt += response.size(); }

And I see, that docsFromScrollCnt > expectedCountFromScroll.
I think, that while query Couchbase auto-indexing view, so I decide to disable auto-indexing by set viewUpdateDeamon’s parameters. I set updateInterval to value, that greater then querying time, updateMinChanges and replicaUpdateMinChanges to zero.

It’s not helped, but I noticed following interesting feature. Count of duplicate documents always equals n*SCROLL_SIZE.

How can I avoid duplicate of document from paginated query?