How to setup the ES cluster using the Client APIs

Hi,

Somehow the default multicast discovery is not working for me and I am
exploring the unicast discovery mechanism to set up a ES cluster on two
physical machines. I am am able to set up it using the default ES
installation on two machines with configuring the both YML files to point
to each other using UNICAST discovery. Now, I want to achieve the same
thing using the ES Client API and I am using the below code for it. Could
you let me know if below code is correct to point to two nodes in UNICAST
or kindly point me to the right direction to refer the sample client code
for it. I am facing issue in the below code and unicast discovery is also
not working in below code.
(I have around one week experience on ES and want to migrate one of the
product from lucene to ES).

Settings settings1 = ImmutableSettings.settingsBuilder()
.put("cluster.name", "PBcluster")
.put("node.name","PBnode1")
.put("node.master", true)
.put("node.data", true)
//.put("http.port", 9250)
//.put("network.bind_host", "152.144.214.62")
// .put("network.publish_host", "152.144.214.62")
.put("discovery.zen.ping.multicast.enabled", false)
// .put("discovery.zen.ping.unicast.hosts", "["152.144.226.12",
"152.144.214.62"]")
.put("discovery.zen.ping.unicast.hosts", "152.144.214.62")
.put("discovery.zen.minimum_master_nodes", 1)
.build();

node1 = nodeBuilder().settings(settings1).node();
System.out.println("Starting node1...");
node1.start();
System.out.println("Started node1...");
...
Node clientNode =
nodeBuilder().clusterName("PBcluster").client(true).node();
Client client = clientNode.client();
BulkRequestBuilder bulkRequest = client.prepareBulk();
...

Thanks
Gaurav

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALZAj3L0B-h%2BbE%3D5p2MeMigf7jwSDC1FZhOC%3DnDfqtWsG-9Y0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.