Elastic Search configs are as follows:
import java.net.InetAddress;
@Configuration
@EnableElasticsearchRepositories
public class ElasticSearchConfig {
@Value("localhost")
private String host;
@Value("9300")
private int port;
@Value("elasticsearch")
private String clusterName;
@Bean
public Client client() throws Exception {
Settings esSettings = Settings.builder()
.put("cluster.name", clusterName)
.put("node.name", "node-1")
.put("node.attr.rack","r1")
.put("client.transport.sniff", true)
.build();
TransportClient transportClient = new PreBuiltTransportClient(esSettings);
transportClient.addTransportAddress(new TransportAddress(InetAddress.getByName(host),port));
return transportClient;
}
/* @Bean
public ElasticsearchOperations elasticsearchTemplate() throws Exception {
return new ElasticsearchTemplate(client());
}*/
}
I am getting following exception like:
NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{6cirTCG_SJW0yPPONMB-HQ}{localhost}{127.0.0.1:9300}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:349)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:247)
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:60)
at
Please suggest
I tried by enabling all the different properties like client.transport.sniffing, node.attr.rack etc. I have enabled all these properties in elasticsearch.yml