public class BulkRequest extends ActionRequest<BulkRequest> implements CompositeIndicesRequest
IndexRequests and DeleteRequests and allows to executes
it in a single batch.Client.bulk(BulkRequest)TransportRequest.Empty| Modifier and Type | Field and Description |
|---|---|
protected TimeValue |
timeout |
headers| Constructor and Description |
|---|
BulkRequest() |
| Modifier and Type | Method and Description |
|---|---|
BulkRequest |
add(ActionRequest... requests)
Adds a list of requests to be executed.
|
BulkRequest |
add(ActionRequest request) |
BulkRequest |
add(ActionRequest request,
Object payload) |
BulkRequest |
add(byte[] data,
int from,
int length)
Adds a framed data in binary format
|
BulkRequest |
add(byte[] data,
int from,
int length,
String defaultIndex,
String defaultType)
Adds a framed data in binary format
|
BulkRequest |
add(BytesReference data,
String defaultIndex,
String defaultType)
Adds a framed data in binary format
|
BulkRequest |
add(BytesReference data,
String defaultIndex,
String defaultType,
boolean allowExplicitIndex)
Adds a framed data in binary format
|
BulkRequest |
add(BytesReference data,
String defaultIndex,
String defaultType,
String defaultRouting,
Object payload,
boolean allowExplicitIndex) |
BulkRequest |
add(DeleteRequest request)
Adds an
DeleteRequest to the list of actions to execute. |
BulkRequest |
add(DeleteRequest request,
Object payload) |
BulkRequest |
add(IndexRequest request)
Adds an
IndexRequest to the list of actions to execute. |
BulkRequest |
add(IndexRequest request,
Object payload) |
BulkRequest |
add(Iterable<ActionRequest> requests)
Adds a list of requests to be executed.
|
BulkRequest |
add(UpdateRequest request)
Adds an
UpdateRequest to the list of actions to execute. |
BulkRequest |
add(UpdateRequest request,
Object payload) |
WriteConsistencyLevel |
consistencyLevel() |
BulkRequest |
consistencyLevel(WriteConsistencyLevel consistencyLevel)
Sets the consistency level of write.
|
long |
estimatedSizeInBytes()
The estimated size in bytes of the bulk request.
|
int |
numberOfActions()
The number of actions in the bulk request.
|
List<Object> |
payloads()
The list of optional payloads associated with requests in the same order as the requests.
|
void |
readFrom(StreamInput in) |
boolean |
refresh() |
BulkRequest |
refresh(boolean refresh)
Should a refresh be executed post this bulk operation causing the operations to
be searchable.
|
ReplicationType |
replicationType()
Deprecated.
will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
|
BulkRequest |
replicationType(ReplicationType replicationType)
Deprecated.
will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
|
List<ActionRequest> |
requests()
The list of requests in this bulk request.
|
List<? extends IndicesRequest> |
subRequests()
Returns the subrequests that a composite request is composed of
|
TimeValue |
timeout() |
BulkRequest |
timeout(String timeout)
A timeout to wait if the index operation can't be performed immediately.
|
BulkRequest |
timeout(TimeValue timeout)
A timeout to wait if the index operation can't be performed immediately.
|
ActionRequestValidationException |
validate() |
void |
writeTo(StreamOutput out) |
listenerThreaded, listenerThreadedputHeader, remoteAddress, remoteAddresscontextSize, copyContextAndHeadersFrom, copyContextFrom, copyHeadersFrom, getContext, getFromContext, getFromContext, getHeader, getHeaders, hasHeader, hasInContext, isContextEmpty, putAllInContext, putInContextprotected TimeValue timeout
public BulkRequest add(ActionRequest... requests)
public BulkRequest add(ActionRequest request)
public BulkRequest add(ActionRequest request, @Nullable Object payload)
public BulkRequest add(Iterable<ActionRequest> requests)
public BulkRequest add(IndexRequest request)
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).public BulkRequest add(IndexRequest request, @Nullable Object payload)
public BulkRequest add(UpdateRequest request)
UpdateRequest to the list of actions to execute.public BulkRequest add(UpdateRequest request, @Nullable Object payload)
public BulkRequest add(DeleteRequest request)
DeleteRequest to the list of actions to execute.public BulkRequest add(DeleteRequest request, @Nullable Object payload)
public List<ActionRequest> requests()
public List<? extends IndicesRequest> subRequests()
CompositeIndicesRequestsubRequests in interface CompositeIndicesRequest@Nullable public List<Object> payloads()
public int numberOfActions()
public long estimatedSizeInBytes()
public BulkRequest add(byte[] data, int from, int length) throws Exception
Exceptionpublic BulkRequest add(byte[] data, int from, int length, @Nullable String defaultIndex, @Nullable String defaultType) throws Exception
Exceptionpublic BulkRequest add(BytesReference data, @Nullable String defaultIndex, @Nullable String defaultType) throws Exception
Exceptionpublic BulkRequest add(BytesReference data, @Nullable String defaultIndex, @Nullable String defaultType, boolean allowExplicitIndex) throws Exception
Exceptionpublic BulkRequest add(BytesReference data, @Nullable String defaultIndex, @Nullable String defaultType, @Nullable String defaultRouting, @Nullable Object payload, boolean allowExplicitIndex) throws Exception
Exceptionpublic BulkRequest consistencyLevel(WriteConsistencyLevel consistencyLevel)
WriteConsistencyLevel.DEFAULTpublic WriteConsistencyLevel consistencyLevel()
public BulkRequest refresh(boolean refresh)
public boolean refresh()
@Deprecated public BulkRequest replicationType(ReplicationType replicationType)
@Deprecated public ReplicationType replicationType()
public final BulkRequest timeout(TimeValue timeout)
public final BulkRequest timeout(String timeout)
public TimeValue timeout()
public ActionRequestValidationException validate()
validate in class ActionRequest<BulkRequest>public void readFrom(StreamInput in) throws IOException
readFrom in interface StreamablereadFrom in class ActionRequest<BulkRequest>IOExceptionpublic void writeTo(StreamOutput out) throws IOException
writeTo in interface StreamablewriteTo in class ActionRequest<BulkRequest>IOExceptionCopyright © 2009–2016. All rights reserved.