我正在尝试做this sample tutorial,以便熟悉elasticsearch.但是运行项目会在intellij中出现这个错误:
org.elasticsearch.transport.NodeDisconnectedException: [][127.0.0.1:9300][cluster:monitor/nodes/liveness] disconnected
2017-08-22 13:32:10.489 ERROR 6372 --- [ main] .d.e.r.s.AbstractElasticsearchRepository : Failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{127.0.0.1}{127.0.0.1:9300}]
2017-08-22 13:32:10.669 INFO 6372 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
--ElasticSearch-->
client.type = transport
cluster.name = mkyong-cluster
name = Mahkizmo
network.server = false
node.client = true
transport.ping_schedule = 5s
<--ElasticSearch--
2017-08-22 13:32:10.751 INFO 6372 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-08-22 13:32:10.755 ERROR 6372 --- [ main] o.s.boot.SpringApplication : Application startup Failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:779) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:760) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:747) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at com.mkyong.Application.main(Application.java:26) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_92]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_92]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_92]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_92]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
Caused by: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{127.0.0.1}{127.0.0.1:9300}]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:326) ~[elasticsearch-2.4.4.jar:2.4.4]
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:223) ~[elasticsearch-2.4.4.jar:2.4.4]
at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55) ~[elasticsearch-2.4.4.jar:2.4.4]
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:295) ~[elasticsearch-2.4.4.jar:2.4.4]
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:359) ~[elasticsearch-2.4.4.jar:2.4.4]
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:86) ~[elasticsearch-2.4.4.jar:2.4.4]
at org.elasticsearch.act
并在elasticsearch.bat中它给出了这个错误:
java.lang.IllegalStateException: Received message from unsupported version: [2.0
.0] minimal compatible version is: [5.0.0]
at org.elasticsearch.transport.TcpTransport.messageReceived(TcpTransport
.java:1379) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channe
lRead(Netty4MessageChannelHandler.java:74) ~[transport-netty4-5.5.2.jar:5.5.2]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst
ractChannelHandlerContext.java:362) [netty-transport-4.1.11.Final.jar:4.1.11.Fin
al]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst
ractChannelHandlerContext.java:348) [netty-transport-4.1.11.Final.jar:4.1.11.Fin
al]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(Abstra
ctChannelHandlerContext.java:340) [netty-transport-4.1.11.Final.jar:4.1.11.Final
]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMes
sageDecoder.java:310) [netty-codec-4.1.11.Final.jar:4.1.11.Final]
我搜索过,据说春季启动和elasticsearch版本之间可能存在冲突.但是在该教程的pom文件中没有指定弹性搜索版本:
是版本冲突的问题,我该如何解决?
最佳答案
看看我的Github repository.它适用于Elasticsearch版本2.4.6的实例.
原文链接:https://www.f2er.com/spring/431376.html不幸的是,Spring Boot Starter Data Elasticsearch不支持Elasticsearch 5.x版,他们正在研究它,但您可以使用我的存储库只是改变模型属性并使用您自己的方法更新存储库.
您的错误是因为您正在使用Elasticsearch 5.x的实例,并且您需要2.x版本.