How to connect to docker instance of elasticsearch

I have used elastic search(rest high level client) in spring boot. The local instance of my computer running fine. But, when I am trying to access the azure vm docker instance I can't able to use. I can able to get json file when hitting say the host name) And I am using mentioed cluster name in that json in my spring boot application = docker-cluster

And I set the =
In docker I have 2 port running 9200 and 9300 having same port for outside container

And I ran my program which was giving error. Then I opened my laptop's localhost instance and kept the cluster node sam and it ran but was not storing in docker instance. Later, found out it is uisng laptop's local instance, then I gave random cluster-nodes. For which also it toop laptop's local instance

And, in docker logs for es container there is no log of connected, index created, delted, or data inserted nothing.

And when I turned off local instance of laptop and ran. Still it is pointing to local instance

Caused by: Timeout connecting to [localhost/]

I tried debugging but when it went out of spring boot to elastic search files, it showed "source file not found". So, I can't able to debug properly

What to do?

Not sure what you did. It's probably a Spring data elasticsearch concern or you did not open your Azure cluster to the machine where your application is running.

Did you read BTW ? Are you sure that setting sets the nodes for elasticsearch client?

You should first try to run from your machine where the app is running:


If it works well, then you need to solve the problem on spring data side.
If it does not work, then probably your Azure 9200 port is not opened for your machine.

But please don't expose your 9200 port to internet. At least not without any security layer.

By default it was connecting to localhost:9200, not to my docker based.
After giving this in it worked =

Before, that it can not able to point, so I think by default it was pointing to localhost

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.