Java 2.2.8 client Upsert Failing On Bucket With Views

I’m currently evaluating Couchbase for my organization and have ran into a snag that for the life of me I have not been able to resolve. The use case is mostly straightforward so I’ll try to explain. I am currently running a two node cluster of Couchbase. I have created a single couchbase bucket enabling 1 replica and am trying to populate it with RawJsonDocuments.

I am doing a bulk load of RawJsonDocuments utilizing the java client version 2.2.8 and the rx observable. Here is snippet of the code used to load the documents.

private Func1<RawJsonDocument, Observable<RawJsonDocument>> upsertFunction = new Func1<RawJsonDocument, Observable<RawJsonDocument>>() {

        public Observable<RawJsonDocument> call(final RawJsonDocument docToInsert) {
            return bucket.async().insert(docToInsert);

I’m iterating over this code thousands of times loading a thousand documents at a time. This code works with no problems as long as the bucket I’m inserting into has no views defined. I’ve loaded 30 million documents within the same batch operation without issue. However, as soon as I add a view to the bucket, I start seeing the following error in our logs after about 500,000 upserts:

OnErrorThrowable.OnNextValue: OnError while emitting onNext value: com.couchbase.client.core.message.kv.UpsertResponse.class


The mapping function within the bucket is trivial:

function (doc, meta) {
  if(doc.documentType == "FooDocument") {
    emit(, doc);

The error seems to occur as the indexer is running on the view but this may just be coincidence. Has anyone else ran into this issue? Is there something foolish I’m doing here? Any help here would be much appreciated!

Hi @kevin.whittington,

Can you add the handler for OnError and check what exception is raised. It may or may not be related to views, but it would be good to know what the actual exception is.