spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.19k stars 40.69k forks source link

Springboot and Elasticsearch 5.2.1 can't connect #8989

Closed zonorion closed 7 years ago

zonorion commented 7 years ago

Hi all, I used spring boot 1.5.3 REALESE, i try to connect to elasticsearch 5.2.1 but get error. My config: ` @Configuration @EnableElasticsearchRepositories(basePackages = "com.elasticsearch") @PropertySource("classpath:config/${spring.profiles.active}/database.properties")

public class ElasticsearchConfiguration {
@Value("${spring.data.elasticsearch.cluster}")
private String clusterName;
@Value("${spring.data.elasticsearch.host}")
private String esHost;
@Value("${spring.data.elasticsearch.port}")
private String esPort;

@Bean
public ElasticsearchTemplate elasticsearchTemplate() throws UnknownHostException {
        Settings settings = Settings.settingsBuilder()
            .put("cluster.name", clusterName).build();
        TransportClient client = TransportClient.builder().settings(settings).build()
            .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(esHost), Integer.parseInt(esPort)));
        return new ElasticsearchTemplate(client);

}

}` but get error message:

2017-04-25 14:49:57.016 INFO 1586 --- [ main] org.elasticsearch.client.transport : [Star-Dancer] failed to get node info for {#transport#-1}{172.16.8.70}{172.16.8.70:9301}, disconnecting... org.elasticsearch.transport.NodeDisconnectedException: [][172.16.8.70:9301] [cluster:monitor/nodes/liveness] disconnected

Could you tell me how can i fixed it? Thanks all :)

wilkinsona commented 7 years ago

Elasticsearch 5.x isn't supported by Spring Data Elasticsearch. See this JIRA ticket.