Exception in thread "main" java.lang.NoSuchMethodError: org.elasticsearch.client.Request.addParameters(Ljava/util/Map;)V
at org.elasticsearch.client.IndicesRequestConverters.getIndex(IndicesRequestConverters.java:489)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1607)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1596)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1563)
at org.elasticsearch.client.IndicesClient.get(IndicesClient.java:677)
at com.sunwei.springboot.UserController.getIndices(UserController.java:105)
at com.sunwei.springboot.UserController.main(UserController.java:87)
这个异常是es的client执行时报的,猜测是springboot默认了集成了某个版本的es导致的,所以我们需要在pom.xml里显式的声明我们es的版本:
7.8.0