當前位置: 首頁>>代碼示例>>Java>>正文


Java BulkProcessor.builder方法代碼示例

本文整理匯總了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();
}
 
開發者ID:apache,項目名稱:samza,代碼行數:20,代碼來源:BulkProcessorFactory.java

示例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();
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:32,代碼來源:ElasticsearchSinkBase.java

示例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;
}
 
開發者ID:JM-Lab,項目名稱:utils-elasticsearch,代碼行數:31,代碼來源:JMElasticsearchBulk.java


注:本文中的org.elasticsearch.action.bulk.BulkProcessor.builder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。