我使用3.0.0版本的spring-data-elasticsearch,在使用过程中出现问题,有时成功,有时会报告错误
没有配置的节点可用:[
{#transport#-1} {S0DLwdVZRk-Osl4KgxM91A} {127.0.0.1} {127.0.0.1:9300}
Elasticsearch是5.4.0版。
我的 Spring 配置文件是
<elasticsearch:repositories base-package="com.ai.notify.es.repository"/>
<elasticsearch:transport-client id="client" cluster-nodes="127.0.0.1:9300"
cluster-name="my-message" />
<bean name="elasticsearchTemplate"
class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
<constructor-arg name="client" ref="client"/>
</bean>
而我的elasticsearch.yml是
cluster.name: my-message
client.transport.ignore_cluster_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"
client.transport.sniff: true
这是因为原因。
不会经常出现此错误,但偶尔会出现
最佳答案
spring-data-elastic 3.0.0.BUILD-SNAPSHOT使用5.5.0版的 flex 搜索客户端库。参见pom.xml。因此,您的 flex 搜索服务器版本必须为和 5.5.0。甚至不包括5.5.1或5.5.2或5.5.3或5.5.4等。恰好是5.5.0。
关于elasticsearch - spring-data-elasticsearch-没有配置的节点可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44797588/