Package org.elasticsearch.action.bulk
Class BulkRequestBuilder
java.lang.Object
org.elasticsearch.action.ActionRequestBuilder<BulkRequest,BulkResponse>
org.elasticsearch.action.bulk.BulkRequestBuilder
- All Implemented Interfaces:
WriteRequestBuilder<BulkRequestBuilder>
public class BulkRequestBuilder
extends ActionRequestBuilder<BulkRequest,BulkResponse>
implements WriteRequestBuilder<BulkRequestBuilder>
A bulk request holds an ordered
IndexRequests and DeleteRequests and allows to executes
it in a single batch.-
Field Summary
Fields inherited from class org.elasticsearch.action.ActionRequestBuilder
action, client, request -
Constructor Summary
ConstructorsConstructorDescriptionBulkRequestBuilder(ElasticsearchClient client, BulkAction action)BulkRequestBuilder(ElasticsearchClient client, BulkAction action, String globalIndex)BulkRequestBuilder(ElasticsearchClient client, BulkAction action, String globalIndex, String globalType)Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionadd(byte[] data, int from, int length, String defaultIndex, String defaultType, org.elasticsearch.common.xcontent.XContentType xContentType)Deprecated.useadd(byte[], int, int, String, XContentType)insteadadd(byte[] data, int from, int length, String defaultIndex, org.elasticsearch.common.xcontent.XContentType xContentType)Adds a framed data in binary formatadd(byte[] data, int from, int length, org.elasticsearch.common.xcontent.XContentType xContentType)Adds a framed data in binary formatadd(DeleteRequest request)Adds anDeleteRequestto the list of actions to execute.add(DeleteRequestBuilder request)Adds anDeleteRequestto the list of actions to execute.add(IndexRequest request)Adds anIndexRequestto the list of actions to execute.add(IndexRequestBuilder request)Adds anIndexRequestto the list of actions to execute.add(UpdateRequest request)Adds anUpdateRequestto the list of actions to execute.add(UpdateRequestBuilder request)Adds anUpdateRequestto the list of actions to execute.intThe number of actions currently in the bulk.setTimeout(String timeout)A timeout to wait if the index operation can't be performed immediately.setTimeout(org.elasticsearch.core.TimeValue timeout)A timeout to wait if the index operation can't be performed immediately.setWaitForActiveShards(int waitForActiveShards)A shortcut forsetWaitForActiveShards(ActiveShardCount)where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)to get the ActiveShardCount.setWaitForActiveShards(ActiveShardCount waitForActiveShards)Sets the number of shard copies that must be active before proceeding with the write.Methods inherited from class org.elasticsearch.action.ActionRequestBuilder
execute, execute, get, get, get, requestMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.action.support.WriteRequestBuilder
request, setRefreshPolicy, setRefreshPolicy
-
Constructor Details
-
BulkRequestBuilder
@Deprecated public BulkRequestBuilder(ElasticsearchClient client, BulkAction action, @Nullable String globalIndex, @Nullable String globalType)Deprecated. -
BulkRequestBuilder
public BulkRequestBuilder(ElasticsearchClient client, BulkAction action, @Nullable String globalIndex) -
BulkRequestBuilder
-
-
Method Details
-
add
Adds anIndexRequestto the list of actions to execute. Follows the same behavior ofIndexRequest(for example, if no id is provided, one will be generated, or usage of the create flag). -
add
Adds anIndexRequestto the list of actions to execute. Follows the same behavior ofIndexRequest(for example, if no id is provided, one will be generated, or usage of the create flag). -
add
Adds anDeleteRequestto the list of actions to execute. -
add
Adds anDeleteRequestto the list of actions to execute. -
add
Adds anUpdateRequestto the list of actions to execute. -
add
Adds anUpdateRequestto the list of actions to execute. -
add
public BulkRequestBuilder add(byte[] data, int from, int length, org.elasticsearch.common.xcontent.XContentType xContentType) throws ExceptionAdds a framed data in binary format- Throws:
Exception
-
add
@Deprecated public BulkRequestBuilder add(byte[] data, int from, int length, @Nullable String defaultIndex, @Nullable String defaultType, org.elasticsearch.common.xcontent.XContentType xContentType) throws ExceptionDeprecated.useadd(byte[], int, int, String, XContentType)insteadAdds a framed data in binary format- Throws:
Exception
-
add
public BulkRequestBuilder add(byte[] data, int from, int length, @Nullable String defaultIndex, org.elasticsearch.common.xcontent.XContentType xContentType) throws ExceptionAdds a framed data in binary format- Throws:
Exception
-
setWaitForActiveShards
Sets the number of shard copies that must be active before proceeding with the write. SeeReplicationRequest.waitForActiveShards(ActiveShardCount)for details. -
setWaitForActiveShards
A shortcut forsetWaitForActiveShards(ActiveShardCount)where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)to get the ActiveShardCount. -
setTimeout
A timeout to wait if the index operation can't be performed immediately. Defaults to1m. -
setTimeout
A timeout to wait if the index operation can't be performed immediately. Defaults to1m. -
numberOfActions
public int numberOfActions()The number of actions currently in the bulk. -
pipeline
-
routing
-
BulkRequestBuilder(ElasticsearchClient, BulkAction, String)instead