I am using Elasticsearch 7.1.1 with spring-boot 2.1.5. I downloaded Elasticsearch and run it. When I start the spring project I am getting an error. The is "failed to load Elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{rsi4dYt_RuOBGCdwUH3Cgg}{127.0.0.1}{127.0.0.1:9200}]". How can I runt it correctly
I used these configurations.
spring.elasticsearch.jest.multi-threaded=true
spring.main.allow-bean-definition-overriding=true
spring.data.elasticsearch.cluster-nodes=localhost:9200
spring.data.elasticsearch.repositories.enabled=true
spring.elasticsearch.jest.uris=http://localhost:9200
spring.elasticsearch.jest.connection-timeout=3s
spring.elasticsearch.rest.uris=http://localhost:9200
spring.data.elasticsearch.cluster-name=elasticsearch
and
@Configuration
@EnableElasticsearchRepositories(basePackages =
"com.example.elasticsearch.repository")
public class ElasticSearchConfiguration {
@Bean
public Client client() throws UnknownHostException {
Settings settings = Settings.builder()
.put("client.transport.sniff", true)
.put("cluster.name", "elasticsearch").build();
@SuppressWarnings("resource")
TransportClient client = new PreBuiltTransportClient(settings)
.addTransportAddress(new
TransportAddress(InetAddress.getByName("127.0.0.1"), 9200));
return client;
}
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws
UnknownHostException {
return new ElasticsearchTemplate(client());
}
}