Skip to content
Advertisement

Getting Exceptions while running a Spring boot app with elasticsearch

I was following this tutorial: https://www.youtube.com/watch?v=IiZZAu2Qtp0&ab_channel=LiliumCode

and the only changes I made were that I was using maven with eclipse instead. The rest of the code is exactly the same. When I run the app I get:

JavaScript

My elasticsearch.yml:

JavaScript

I have tried out searching the exceptions online but nothing seems to work. Please help me in figuring this out. Thank you.

Advertisement

Answer

ConnectionClosedException seems to hint at the fact that your Spring Boot application cannot establish a connection to your ES cluster.

It looks like you’re using ES8, which has SSL/TLS on by default, so you would need to configure your Spring Boot application to use SSL instead.

At 6:00 into the video, elasticsearch.url in application.properties should be https://localhost:9200 instead of just localhost:9200.

However, as of March 15th 2022, it doesn’t seem like ES 8 is supported by Spring Data ES yet, you might need to revert to the ES 7.15+ release.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement