springboot package version abnormal project dependencies es

 

 

 

 Add dependency in the pom.xml project

<dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>elasticsearch-rest-high-level-client</artifactId>
    <version>7.6.1</version>
</dependency>

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

 

 Down version 6.4.3 will always find items, and will refer to this version and then start the project, the method will not find the abnormal

 

 

Exception in thread "main" java.lang.NoSuchMethodError: org.elasticsearch.client.Request.addParameters(Ljava/util/Map;)V
at org.elasticsearch.client.RequestConverters.index(RequestConverters.java:341)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1510)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1484)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1454)
at org.elasticsearch.client.RestHighLevelClient.index(RestHighLevelClient.java:871)
at com.majb.es.ESMain.main(ESMain.java:23)

 

Point into RequestConverters references found in version 7.6.1,

Request references and version is 6.4.3. Obviously version of the problem. It would be surprising, and I quote the 7.6.1 version, but rest-client package is 6.4.3.

 

 

The reason is because I use the springboot version 2.1.6. This version of springboot default referral is es version 6.4.3. So we have to specify the version of es in pom.xml explicitly

 <properties>
        <elasticsearch.version>7.6.1</elasticsearch.version>
    </properties>

 

Guess you like

Origin www.cnblogs.com/zhangXingSheng/p/12500296.html