在Spring Boot中找不到Elasticsearch方法 [英] Elasticsearch method not being found in spring boot
问题描述
我已经在这个问题上停留了一段时间,我们将为您提供任何帮助。我正在运行带有ElasticSearch高级REST客户端版本 6.4.3
的Spring Boot版本 2.2.0
并使用版本 3.2.0
对于Spring-Data-Elasticsearch版本。我收到下面的错误。我尝试了以下修复方法,但没有解决。
I have been stuck with this issue for a while now and any assistance is appreciated. I am running Spring Boot version 2.2.0
with the ElasticSearch high-level REST Client version 6.4.3
and using version 3.2.0
for the Spring-Data-Elasticsearch version. I am getting the error below. I have tried the following attempts to fix but none do.
- 多次更改Spring Boot版本
- 多次更改ES版本
- 我已清除.m2文件夹并多次重新下载了Maven依赖项。
我要解决的问题是
试图调用一个不存在的方法。尝试从以下位置进行:
org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.putMapping(ElasticsearchRestTemplate .java:292)
org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.putMapping(ElasticsearchRestTemplate.java:292)
以下方法不存在:
org.elasticsearch.client.IndicesClient.putMapping(Lorg / elasticsearch / action / admin / indices / mapping / put / PutMappingRequest; Lorg / elasticsearch / client / RequestOptions;)Lorg / elasticsearch / action / support / master / AcknowledgedResponse;
org.elasticsearch.client.IndicesClient.putMapping(Lorg/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest;Lorg/elasticsearch/client/RequestOptions;)Lorg/elasticsearch/action/support/master/AcknowledgedResponse;
该方法的类org.elasticsearch.client.IndicesClient可从以下位置:
The method's class, org.elasticsearch.client.IndicesClient, is available from the following locations:
jar:file:/Users/user/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high -level-client / 6.4.3 / elasticsearch-rest-high-level-client-6.4.3.jar!/org/elasticsearch/client/IndicesClient.class
jar:file:/Users/user/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/6.4.3/elasticsearch-rest-high-level-client-6.4.3.jar!/org/elasticsearch/client/IndicesClient.class
它是从th加载的以下位置:
文件:/Users/user/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/6.4.3/elasticsearch-rest-high-level-client- 6.4.3.jar
It was loaded from the following location: file:/Users/user/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/6.4.3/elasticsearch-rest-high-level-client-6.4.3.jar
操作:
更正应用程序的类路径,使其包含一个兼容的org.elasticsearch.client版本。 .IndicesClient
我的POM低于
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>3.2.0</version>
</dependency>
感谢您的帮助。我确定它必须处理兼容性问题,但不能确定哪个。谢谢大家!
Any help is appreciated. I am sure it has to deal with compatibility issues but not sure which. Thanks all!
我能够通过将我的Elasticsearch版本更改为<$来使其成功运行。 c $ c> 6.7.0 。但是现在我收到以下错误
I was able to get it run sucessfully by changing my elasticsearch version to 6.7.0
. But now I am receiving the following error
org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=index_not_found_exception, reason=no such index]
我的POM现在也如下所示。
My POM looks like this below now also.
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.70</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>6.70</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>6.70</version>
</dependency>
推荐答案
以前的方法问题不存在。
通过将elasticsearch版本更改为 6.7.0
来解决。
Previous issue of method that does not exist.
was resolved by changing the elasticsearch version to 6.7.0
.
为避免这些不兼容问题,始终建议使用相同版本的Elasticsearch服务器及其客户端。
这篇关于在Spring Boot中找不到Elasticsearch方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!