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
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 :)
精彩评论