Java Bulk add


#1

Does Couchbase support bulk add in a similar manner as CouchDB?

In other words, I would like to update a Couchbase bucket with a List of json objects,
each representing a different document.

paul


#2

Hi ,I dont think couchbase has any functions or APIs in JAVA SDK for bulk insert,
But you can use OperationFuture in java to implement Asynchronous insert.


#3

The Java SDK 2.0 provides capabilities for bulk insert, read here: http://docs.couchbase.com/developer/java-2.0/documents-bulk.html
You are right that the 1.4 SDK has no bulk operations, but you can simulate them with async ops and listeners.

Let me know if you have something specific in mind,
Cheers
Michael


#4

Hey,

We use Couchbase Client in version 1.4.5. Currently we insert more than 3000 pairs of key & data in json format to the couchbase, one by one, just iterating over all possible keys, and then using set(String key, int exp, Object o) method.

On the base of your conversation, I see that there’s no bulk insert for Java SDK 1.4. You suggest using async ops, and listeners. Because I am new to Couchbase and CB Java SDK, how can it be done? Suppose I have a Map<String, String> that holds keys and corresponding data, e.g.:

key1 - { “type” : “message”, “date” : “2015-01-01” }
key2 - { “type” : “error”, “date” : “2015-01-02” }

key3000 - { “type” : “messsage”, “date” : “2015-02-01” }

How can I build bulk operation to Couchbase and is it worth doing it (performance, times, etc.)?

Thanks in advance for any help.

Regards,

Maciek