本文整理汇总了Java中org.elasticsearch.action.bulk.BulkProcessor.builder方法的典型用法代码示例。如果您正苦于以下问题:Java BulkProcessor.builder方法的具体用法?Java BulkProcessor.builder怎么用?Java BulkProcessor.builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.action.bulk.BulkProcessor
的用法示例。
在下文中一共展示了BulkProcessor.builder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBulkProcessor
import org.elasticsearch.action.bulk.BulkProcessor; //导入方法依赖的package包/类
public BulkProcessor getBulkProcessor(Client client, BulkProcessor.Listener listener) {
BulkProcessor.Builder builder = BulkProcessor.builder(client, listener);
// Concurrent requests set to 0 to ensure ordering of documents is maintained in batches.
// This also means BulkProcessor#flush() is blocking as is also required.
builder.setConcurrentRequests(0);
if (config.getBulkFlushMaxActions().isPresent()) {
builder.setBulkActions(config.getBulkFlushMaxActions().get());
}
if (config.getBulkFlushMaxSizeMB().isPresent()) {
builder.setBulkSize(new ByteSizeValue(config.getBulkFlushMaxSizeMB().get(), ByteSizeUnit.MB));
}
if (config.getBulkFlushIntervalMS().isPresent()) {
builder.setFlushInterval(TimeValue.timeValueMillis(config.getBulkFlushIntervalMS().get()));
}
return builder.build();
}
示例2: buildBulkProcessor
import org.elasticsearch.action.bulk.BulkProcessor; //导入方法依赖的package包/类
/**
* Build the {@link BulkProcessor}.
*
* <p>Note: this is exposed for testing purposes.
*/
@VisibleForTesting
protected BulkProcessor buildBulkProcessor(BulkProcessor.Listener listener) {
checkNotNull(listener);
BulkProcessor.Builder bulkProcessorBuilder = BulkProcessor.builder(client, listener);
// This makes flush() blocking
bulkProcessorBuilder.setConcurrentRequests(0);
if (bulkProcessorFlushMaxActions != null) {
bulkProcessorBuilder.setBulkActions(bulkProcessorFlushMaxActions);
}
if (bulkProcessorFlushMaxSizeMb != null) {
bulkProcessorBuilder.setBulkSize(new ByteSizeValue(bulkProcessorFlushMaxSizeMb, ByteSizeUnit.MB));
}
if (bulkProcessorFlushIntervalMillis != null) {
bulkProcessorBuilder.setFlushInterval(TimeValue.timeValueMillis(bulkProcessorFlushIntervalMillis));
}
// if backoff retrying is disabled, bulkProcessorFlushBackoffPolicy will be null
callBridge.configureBulkProcessorBackoff(bulkProcessorBuilder, bulkProcessorFlushBackoffPolicy);
return bulkProcessorBuilder.build();
}
示例3: getBulkProcessorBuilder
import org.elasticsearch.action.bulk.BulkProcessor; //导入方法依赖的package包/类
/**
* Gets the bulk processor builder.
*
* @param bulkProcessorListener
* the bulk processor listener
* @param bulkActions
* the bulk actions
* @param byteSizeValue
* the byte size value
* @param flushInterval
* the flush interval
* @param concurrentRequests
* the concurrent requests
* @param backoffPolicy
* the backoff policy
* @return the bulk processor builder
*/
public Builder getBulkProcessorBuilder(Listener bulkProcessorListener,
Integer bulkActions, ByteSizeValue byteSizeValue,
TimeValue flushInterval, Integer concurrentRequests,
BackoffPolicy backoffPolicy) {
Builder builder =
BulkProcessor.builder(jmESClient, bulkProcessorListener);
ifNotNull(bulkActions, builder::setBulkActions);
ifNotNull(byteSizeValue, builder::setBulkSize);
ifNotNull(flushInterval, builder::setFlushInterval);
ifNotNull(concurrentRequests, builder::setConcurrentRequests);
ifNotNull(backoffPolicy, builder::setBackoffPolicy);
return builder;
}