java.lang.NoSuchMethodError: org.elasticsearch.action.index.IndexRequest.ifSeqNo()J

IndexRequest indexRequest = new IndexRequest("pubmed2","_doc","2").source(jsonMap);
var indexResponse = restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT);
他发生java.lang.NoSuchMethodError: org.elasticsearch.action.index.IndexRequest.ifSeqNo()J错误,
"mapping": {
"properties": {
"id": {
"type": "integer"

If using any dependency tool follow below steps:

  1. Exclude "groupd Id: org.elasticsearch artifactId:elasticsearch ", "groupId: org.elasticsearch.client artifactId:elasticsearch-rest-client " from elasticsearch-rest-high-level-client(as it loads 6.4.3 version of these jars)

  2. Add dependencies for above two excluded jars with verion 7.0.0 and build.

Are you using spring boot?

Yes I had this issue with Spring boot.

Next time, provide more context. That will help to get a faster answer.

When using springboot with
elasticsearch, you need to be explicit with some transitive dependencies as SpringBoot declares a version 6.4...

Basically you can put this in your pom.xml:


See documentation here:

1 Like

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