I know ElasticSearch manages the creation of clusters automatically. Just have multiple nodes with the same cluster name and a cluster would be formed.
My question is from the application code side of things, when I am creating the TransportClient
that I would use to connect to ElasticSearch, do I need to use a particular host? Or any host I used does not matter and ElasticSearch would ensure that I end up communicating with the cluster?
For example I have hostA
and hostB
with the same clusterName, when creating TransportClient do I need to use addTransportAddress to add both hosts? I would think this is the way to go. Or is there another way to create the TransportClient where I supply just the cluster name for instance?