# Elasticsearch 6.5.4: Initialising BulkProcessor

**URL:** <https://discuss.elastic.co/t/elasticsearch-6-5-4-initialising-bulkprocessor/162782>\
**Category:** Elasticsearch\
**Created:** [January 3, 2019, 10:17am UTC](https://discuss.elastic.co/t/elasticsearch-6-5-4-initialising-bulkprocessor/162782 "2019-01-03T10:17:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LGans316](https://avatars.discourse-cdn.com/v4/letter/l/cab0a1/32.png) [@LGans316](https://discuss.elastic.co/u/LGans316)\
**Post date:** [January 3, 2019, 10:17am UTC](https://discuss.elastic.co/t/elasticsearch-6-5-4-initialising-bulkprocessor/162782/1 "2019-01-03T10:17:05Z")

</div>

Trying to upgrade from 6.4.0 to 6.5.4 and noticed many deprecations. Fixed most of them except for one.

This is how the BulkProcessor was initialised in 6.4.0. indexClient is RestHighLevelClient and BulkProcessorListener implements BulkProcessor.Listener. This is all working fine.

```
			Builder builder = BulkProcessor.builder(indexClient::bulkAsync,
			        new BulkProcessorListener(this.stats, errorLogWriter, appConfig.isDebug()));
			builder.setConcurrentRequests(ElasticSearchConfig.concurrentRequests);
			builder.setBulkActions(indexConfig.getBulkActions());
			builder.setFlushInterval(TimeValue.timeValueSeconds(indexConfig.getBulkFlushInterval()));
			builder.setBackoffPolicy(BackoffPolicy.exponentialBackoff(TimeValue.timeValueMillis(100), 5));
			this.bulkProcessor = builder.build();

```

Now with 6.5.4\*\*, indexClient::bulkAsync\*\* has been deprecated. Also I am unable to pass RestHighLevelClient as first argument as it doesn't implement org.elasticsearch.client.Client interface. Noticed the TransportClient (which is to be deprecated) indirectly implemented Client interface but we don't use TransportClient in our codebase at all. So wondering how BulkProcessor can be initialised using RestHighLevelClient in 6.5.4.

[https://www.elastic.co/guide/en/elasticsearch/client/java-api/6.5/java-docs-bulk-processor.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/6.5/java-docs-bulk-processor.html)

Please advise as this is blocking our migration.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 3, 2019, 10:31am UTC](https://discuss.elastic.co/t/elasticsearch-6-5-4-initialising-bulkprocessor/162782/2 "2019-01-03T10:31:44Z")

</div>

Here is how I'm creating it:

> <https://github.com/dadoonet/legacy-search/blob/02-bulk/src/main/java/fr/pilato/demo/legacysearch/dao/ElasticsearchDao.java#L57-L78>

HTH

---

<div class="post-metadata">

**Author:** ![LGans316](https://avatars.discourse-cdn.com/v4/letter/l/cab0a1/32.png) [@LGans316](https://discuss.elastic.co/u/LGans316)\
**Post date:** [January 3, 2019, 10:38am UTC](https://discuss.elastic.co/t/elasticsearch-6-5-4-initialising-bulkprocessor/162782/3 "2019-01-03T10:38:58Z")

</div>

> [@dadoonet](#):
>
> (request, bulkListener) -\> esClient.bulkAsync(request, RequestOptions.DEFAULT, bulkListener)

Thanks you so much again. Looks like I need to refresh my Java 8 skills 🙂

Also are there any plans to create an overloaded method that doesn't accept RequestOptions as I find it a bit annoying to keep passing RequestOptions.DEFAULT 🙂

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 3, 2019, 11:22am UTC](https://discuss.elastic.co/t/elasticsearch-6-5-4-initialising-bulkprocessor/162782/4 "2019-01-03T11:22:19Z")

</div>

> [@LGans316](#):
>
> Also are there any plans to create an overloaded method that doesn't accept RequestOptions as I find it a bit annoying to keep passing RequestOptions.DEFAULT

I found that a bit annoying too but I'm now used to it.  
Anyway, I don't think there is a plan for this. @javanna do you know?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 31, 2019, 11:22am UTC](https://discuss.elastic.co/t/elasticsearch-6-5-4-initialising-bulkprocessor/162782/5 "2019-01-31T11:22:29Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
