What nodes should we give while connecting to ES cluster from java client

We are using elasticsearch with following topology:
Dedicated master nodes: 3
Dedicated data nodes: 6
ES JAVA clients: 6

While connecting to ES cluster from a java client program, we provide comma separated data hostnames while creating REST

Here is a code snippet:

            private static synchronized RestHighLevelClient createConnection() {
            if(client == null) {
                client = new RestHighLevelClient(
                                new HttpHost(HOST1, PORT, SCHEME),
                                new HttpHost(HOST2, PORT, SCHEME),
                                new HttpHost(HOST3, PORT, SCHEME)));
            return client;
  1. Is this the right way of connecting to ES cluster?
  2. Can we give comma separated master nodes instead of data nodes?
  3. Will there be any performance hit if we use master nodes?

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