I'm using ElasticSearch-5.2.1 with springboot and getting below error in elasticsearch.bat
java.lang.IllegalStateException: Received message from unsupported version: [2.0.0] minimal compatible version is: [5.0.0]
and in my application console getting below error:
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}]
When i search in google it is asking to upgrade transport client but How do i upgrade the transport client from 2.0 to 5.0
below is my config code:
@Value("${elasticsearch.port}")
private int EsPort;
@Value("${elasticsearch.clustername}")
private String EsClusterName;
@Value("${elasticsearch.host}") private String EsHost;
@Bean
public Client client() throws Exception {
Settings esSettings = Settings.settingsBuilder().put("cluster.name", EsClusterName).build();
return TransportClient.builder()
.settings(esSettings)
.build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(EsHost), EsPort));
}
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws Exception {
return new ElasticsearchTemplate(client());
}