org.elasticsearch.action.bulk
Class BulkRequest

java.lang.Object
  extended by org.elasticsearch.action.bulk.BulkRequest
All Implemented Interfaces:
ActionRequest, Streamable

public class BulkRequest
extends java.lang.Object
implements ActionRequest

A bulk request holds an ordered IndexRequests and DeleteRequests and allows to executes it in a single batch.

See Also:
Client.bulk(BulkRequest)

Constructor Summary
BulkRequest()
           
 
Method Summary
 BulkRequest add(byte[] data, int from, int length, boolean contentUnsafe)
          Adds a framed data in binary format
 BulkRequest add(DeleteRequest request)
          Adds an DeleteRequest to the list of actions to execute.
 BulkRequest add(IndexRequest request)
          Adds an IndexRequest to the list of actions to execute.
 boolean listenerThreaded()
          Should the response listener be executed on a thread or not.
 BulkRequest listenerThreaded(boolean listenerThreaded)
          Sets if the response listener be executed on a thread or not.
 int numberOfActions()
           
 void readFrom(StreamInput in)
           
 ActionRequestValidationException validate()
           
 void writeTo(StreamOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BulkRequest

public BulkRequest()
Method Detail

add

public BulkRequest add(IndexRequest request)
Adds an IndexRequest to the list of actions to execute. Follows the same behavior of IndexRequest (for example, if no id is provided, one will be generated, or usage of the create flag).


add

public BulkRequest add(DeleteRequest request)
Adds an DeleteRequest to the list of actions to execute.


add

public BulkRequest add(byte[] data,
                       int from,
                       int length,
                       boolean contentUnsafe)
                throws java.lang.Exception
Adds a framed data in binary format

Throws:
java.lang.Exception

numberOfActions

public int numberOfActions()

validate

public ActionRequestValidationException validate()
Specified by:
validate in interface ActionRequest

listenerThreaded

public boolean listenerThreaded()
Description copied from interface: ActionRequest
Should the response listener be executed on a thread or not.

When not executing on a thread, it will either be executed on the calling thread, or on an expensive, IO based, thread.

Specified by:
listenerThreaded in interface ActionRequest

listenerThreaded

public BulkRequest listenerThreaded(boolean listenerThreaded)
Description copied from interface: ActionRequest
Sets if the response listener be executed on a thread or not.

Specified by:
listenerThreaded in interface ActionRequest

readFrom

public void readFrom(StreamInput in)
              throws java.io.IOException
Specified by:
readFrom in interface Streamable
Throws:
java.io.IOException

writeTo

public void writeTo(StreamOutput out)
             throws java.io.IOException
Specified by:
writeTo in interface Streamable
Throws:
java.io.IOException