NoSuchMethodError - BulkRequest

Hi,

I'm using the High Level Rest client from java. specific version is 6.6.1 against an ES v6.5.4

I'm getting the following error when I try to do a BulkRequest which are all IndexRequests

java.lang.NoSuchMethodError: org.elasticsearch.action.bulk.BulkRequest.pipeline()Ljava/lang/String;

Happy to file an issue, but was wondering if someone might know what's up in case it's a non issue.

Below is the code I'm using:

    BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", "changeme"));

RestClientBuilder builder = RestClient.builder(new HttpHost("asus.local", 9200))
    .setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider));
RestHighLevelClient client = new RestHighLevelClient(builder);
BulkRequest request = new BulkRequest();

String line;
while ((line = reader.readLine()) != null) {
  String[] split = line.split(",");
  Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(split[0]);
  Map< String, Object> jsonMap = new HashMap< String, Object>();
  jsonMap.put("valuedate", date);
  jsonMap.put("value", Double.valueOf(split[1]));
  IndexRequest indexRequest = new IndexRequest("my_index", "doc", String.valueOf(row))
      .source(jsonMap);
  request.add(indexRequest);
}

System.out.println("starting bulk call");
BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT);
System.out.println("DONE");

Not related but I'd recommend using the same version although it's supposed to be compatible unless you change the major version (ie 6.x is not compatible with 7.x).

Coming back to your question, did you check that you did not declared some other libraries using different versions of elasticsearch jars?
If you are using Maven, what is the output of:

mvn dependency:tree

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