0

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

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. Would appreciate if anyone knows what this error is.

I'm definitely using lib 6.6.1

compile 'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.6.1'

Thanks

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");
3
  • Looks like a discrepancy in versions of elasticsearch used to compile/build project and used to run it Commented Feb 28, 2019 at 20:02
  • I thought that might be it, so I downloaded ES 6.6.1 before posting. I'm defo on ES 6.6.1 and here is my gradle dependency: compile 'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.6.1' Commented Feb 28, 2019 at 20:10
  • @JavaGuy look at my answer. You need to upgrade the Core library. Commented Feb 28, 2019 at 20:11

2 Answers 2

2

The

public String pipeline() {
    return globalPipeline;
}

method has been added on version 6.6 of the Elasticsearch Server module (GitHub file - 6.6 branch).

Be sure all the Elastic Search modules share the same version.
As you wrote the Rest Client is 6.6.1, I suspect the Server one is older than that (< 6.6).

You need

<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>6.6.1</version>
</dependency>

Or for Gradle

implementation 'org.elasticsearch:elasticsearch:6.6.1'
Sign up to request clarification or add additional context in comments.

12 Comments

I was using compile 'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.6.1' . I'll try to add the elasticsearch lib you mentioned thx
@JavaGuy that is another module. The one I posted is the Core one. And look for duplicates inside your "dependencies" block.
yes understood thx. I'm adding both the rest high level client and the core module, correct?
@JavaGuy yes, exactly.
that's it thx. dang - not happy since i wasted a bunch of time on it. it would be reasonable to assume that high rest client 6.6.1 would depend on core 6.6.1 would it not? Other products of ELK stack are all in sync version wise (ES, Kibana, LogStash etc). Thanks for your help
|
0
<!-- elasticsearch-rest-high-level-client -->
    <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>elasticsearch-rest-high-level-client</artifactId>
        <version>6.6.1</version>
        <exclusions>
            <exclusion>
                <groupId>org.elasticsearch</groupId>
                <artifactId>elasticsearch</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>6.6.1</version>
    </dependency>

I solved this problem use these code.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.