我正在使用Spring Boot和Elastic-Search創建應用程序。 Spring應用程序部分正在工作。當我啓動Elastic服務器時,它也運行良好。沒有問題。我可以通過POSTMAN和CURL來測試它。添加和搜索也很好。衝刺啓動和彈性搜索連接問題
但是當我運行該應用程序時,出現以下問題。 這是我在IDE中遇到的問題。 (這從我的Java應用程序單元)
org.elasticsearch.client.transport.NoNodeAvailableException:所配置的節點都不是可用的:[{#運輸#-1} {127.0.0.1} {127.0.0.1: 9300}]
而這是我從本地系統上的Elasctic服務器上得到的問題。
java.lang.IllegalStateException:從不受支持的版本收到的消息:[2.0.0]最小兼容版本是:[5.0.0]
這些是我使用的庫。
- 春季啓動1.5.1.RELEASE
- 春季啓動啓動數據Elasticsearch 1.5.1.RELEASE
- 春數據Elasticsearch 2.10.RELEASE
- 彈性搜索5.0
我覺得這是Elastic和以上庫版本不匹配的問題。 我是新的彈性,也春季。版本問題在這裏。 https://github.com/spring-projects/spring-data-elasticsearch/wiki/Spring-Data-Elasticsearch---Spring-Boot---version-matrix
和這裏是我的pom.xml。如果我需要更新任何圖書館,誰能告訴我這是什麼?還請告訴我如何更新這些庫?我可以更新它們而不更改爲我的源代碼嗎?
<?xml version="1.0" encoding="UTF-8"?>
http://maven.apache.org/xsd/maven-4.0.0.xsd「> 4.0.0
<artifactId>springboot-springdata-elasticsearch-example</artifactId>
<packaging>jar</packaging>
<url>https://www.mkyong.com</url>
<version>1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Runtime, for Embedded Elasticsearch,
comment this if connect to external elastic search server-->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Package as an executable jar/war -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
在該pom.xml中,我
根據您鏈接到的版本矩陣,不能將elasticsearch 5.x與您要使用的Spring庫一起使用。你在外部運行elasticsearch嗎?它看起來像。你需要運行一個2.x的elasticsearch。 – Phil
@Phil嘿彈性2.x和5.x之間有什麼變化? –
@Phil我可以更新彈簧庫以使用Elastic 5.x嗎?請幫助我 –