ElasticSearch health check failed every time when spring boot start up
You can disable the Elasticsearch health check by adding the following line to your application.xml
file
management.health.elasticsearch.enabled: false
When I went deep into the same issue happening in my sprint boot app too, I found that elasticsearch health check use org.elasticsearch.client.RestClient
but I was using org.elasticsearch.client.RestHighLevelClient
and had created Bean for the same.
In case you want to keep the recurring elasticsearch's healthcheck,
Create a Bean for RestClient
using the right host and port.
Or add following entry in app config yml/xml to remove healthcheck itself:
management.health.elasticsearch.enabled: false
disable the health indicator auto configuration
@SpringBootApplication(exclude = { ElasticSearchRestHealthIndicatorAutoConfiguration.class})public class YourApplication