Class BulkIngester.Builder<Context>
java.lang.Object
co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester.Builder<Context>
- All Implemented Interfaces:
ObjectBuilder<BulkIngester<Context>>
- Enclosing class:
- BulkIngester<Context>
public static class BulkIngester.Builder<Context>
extends Object
implements ObjectBuilder<BulkIngester<Context>>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbackoffPolicy
(BackoffPolicy backoffPolicy) Sets the backoff policy that will handle retries for error 429: too many requests.build()
client
(ElasticsearchAsyncClient client) client
(ElasticsearchClient client) flushInterval
(long value, TimeUnit unit) Sets an interval flushing any bulk actions pending if the interval passes.flushInterval
(long value, TimeUnit unit, ScheduledExecutorService scheduler) Deprecated.globalSettings
(BulkRequest.Builder settings) Sets global bulk request settings that will be applied to all requests sent by the ingester.Sets global bulk request settings that will be applied to all bulk requests.listener
(BulkListener<Context> listener) maxConcurrentRequests
(int max) Sets the number of concurrent requests allowed to be executed.maxOperations
(int count) Sets when to flush a new bulk request based on the number of operations currently added.maxSize
(long bytes) Sets when to flush a new bulk request based on the size in bytes of actions currently added.scheduler
(ScheduledExecutorService scheduler) Sets a custom scheduler to run the flush thread and the listener logic.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
client
-
client
-
maxOperations
Sets when to flush a new bulk request based on the number of operations currently added. Defaults to1000
. Can be set to-1
to disable it.- Throws:
IllegalArgumentException
- if less than -1.
-
maxSize
Sets when to flush a new bulk request based on the size in bytes of actions currently added. A request is sent once that size has been exceeded. Defaults to 5 megabytes. Can be set to-1
to disable it.- Throws:
IllegalArgumentException
- if less than -1.
-
maxConcurrentRequests
Sets the number of concurrent requests allowed to be executed. A value of 1 means 1 request is allowed to be executed while accumulating new bulk requests. Defaults to1
.- Throws:
IllegalArgumentException
- if less than 1.
-
flushInterval
Sets an interval flushing any bulk actions pending if the interval passes. Defaults to not set.Flushing is still subject to the maximum number of requests set with
maxConcurrentRequests
.- Throws:
IllegalArgumentException
- if not a positive duration.
-
flushInterval
@Deprecated public BulkIngester.Builder<Context> flushInterval(long value, TimeUnit unit, ScheduledExecutorService scheduler) Deprecated.Sets an interval flushing any bulk actions pending if the interval passes. Defaults to not set.Flushing is still subject to the maximum number of requests set with
maxConcurrentRequests
. -
scheduler
Sets a custom scheduler to run the flush thread and the listener logic. A default one is used if not set. -
listener
-
backoffPolicy
Sets the backoff policy that will handle retries for error 429: too many requests. All the times are defined in milliseconds. -
globalSettings
Sets global bulk request settings that will be applied to all requests sent by the ingester. -
globalSettings
public BulkIngester.Builder<Context> globalSettings(Function<BulkRequest.Builder, BulkRequest.Builder> fn) Sets global bulk request settings that will be applied to all bulk requests. -
build
- Specified by:
build
in interfaceObjectBuilder<Context>
-
scheduler(ScheduledExecutorService)