Bulk API
The bulk API allows developers to index and delete multiple documents in a single request. Here is the usage instance.
ImportStatic org.elasticsearch.common.xcontent.xcontentfactory.*; Bulkrequestbuilder bulkrequest = Client.preparebulk ();Either use Client#prepare, or use requests# to directly build Index/delete Requestsbulkrequest.add (client.prepareindex ("Twitter","Tweet","1"). SetSource (Jsonbuilder (). StartObject (). Field ("User","Kimchy"). Field ( "postdate", new Date ()). Field (" trying out Elasticsearch "). EndObject (Bulkrequest.add)) ( "tweet", "2"). SetSource (Jsonbuilder (). StartObject (). Field ( "user", "Kimchy "). Field (" postdate ", new Date ()). Field ( "message", "another post"). EndObject ()); Bulkresponse bulkresponse = Bulkrequest.execute (). Actionget (); if (Bulkresponse.hasfailures ()) {//process failures by Iterating through each bulk response item}
Elasticsearch Chinese API Bulk (vi)