Sameek Mishra
Sameek Mishra

Reputation: 9404

how to connect other machine install Elastic search server?

I'm install elastic search 0.16.2 on Debian Linux.I want to connect elastic server which is install Debian box. previously I install elastic server in my machine.for creating node i used following code:

 Settings settings = ImmutableSettings.settingsBuilder() 
                                .put("index.number_of_shards",1) 
                                .build(); 
       Node node = NodeBuilder.nodeBuilder() 
                                .client(false).settings(settings) 
                                .local(false) 
                                .node().start(); 

Note: “local”meaning that local servers started within the same JVM will discover themselves and form a cluster.

Linux box IPAddress 192.168.1.100 where elastic server is install.where I do changes to connect Linux box elastic search server using java ? Thanks

Upvotes: 1

Views: 868

Answers (1)

Karussell
Karussell

Reputation: 17375

Do you mean to connect via the transport client?

Then this should do it (not sure if you really need to specify the cluster):

Settings s = ImmutableSettings.settingsBuilder().put("cluster.name", cluster).build();
TransportClient client = new TransportClient(s);
client.addTransportAddress(new InetSocketTransportAddress(url, port));

But be sure that ElasticSearch cannot be searched from the rest of the world :)

Upvotes: 1

Related Questions