Using elastic 8.3.2 in java web services & connecting to multiple elastic nodes more than 3 nodes

'I am trying to connect to multiple elastic nodes by configuring the nodes details in properties and using them i am creating the Elasticsearchclient like below and creating for across the container


and by autowiring the Elasticsearchclient and using client to search the templates in elastic but here when i use the client to search the templates like below


the load is always going to one node which is defined in the first in the properties file.

and also if i close/shutdown the client next web request is not having the client to run as its says client is null because we have closed it.

if we create the client for every request using builder and close it then also load is always going to first node defined in the row.

Please guide on load balancing it and closing connection for every new request as we are using this in web service

Welcome to our community! :smiley:

Please don't post pictures of text, logs or code. They are difficult to read, impossible to search and replicate (if it's code), and some people may not be even able to see them :slight_smile:

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