Unable to set headers in Java rest client Bulk request

I am following the example provided in the documentation for creating the bulk request using bulkprocessor. However, I am not sure how to pass headers to bulkAsync. I am using X-Pack and would like to send the auth header as part of the bulk request

  BulkProcessor.Builder builder = BulkProcessor.builder(client::bulkAsync, listener);
  builder.setBulkActions(500);
  builder.setBulkSize(new ByteSizeValue(1L, ByteSizeUnit.MB));
  builder.setConcurrentRequests(0);
  builder.setFlushInterval(TimeValue.timeValueSeconds(10L));
  builder.setBackoffPolicy(BackoffPolicy.constantBackoff(TimeValue.timeValueSeconds(1L), 3));

Documentation link - https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.1/java-rest-high-document-bulk.html

ES version - 6.1.2
Java version - 1.8

This is something to do when you create the Low Level client. Read https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.7/_basic_authentication.html

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