I have set up and started an elastic search node and confirmed it's
working with a couple of Python scripts. I have indexed a bunch of
documents and am able to search over them. However, I am having
trouble getting the Java client API working. So far I just have a very
simple class that attempts to connect to the server with a
TransportClient but it's hanging on the call to addTransportAddress.
public class ElasticTest {
public static void main(String[] args) {
Settings settings = ImmutableSettings.settingsBuilder() //
.put("cluster.name", "hotels") //
.put("client.transport.sniff", false) //
.build();
TransportClient client = new TransportClient(settings);
InetSocketTransportAddress transAddress = new
InetSocketTransportAddress("linux-dev", 9200);
client.addTransportAddress(transAddress);
client.close();
}
}
I have tried debugging it and hanging in
org.elasticsearch.client.transport.TransportClientNodeService on line
176 (stack copied below). Do you know what I might be doing wrong?
I have set up and started an Elasticsearch node and confirmed it's
working with a couple of Python scripts. I have indexed a bunch of
documents and am able to search over them. However, I am having
trouble getting the Java client API working. So far I just have a very
simple class that attempts to connect to the server with a
TransportClient but it's hanging on the call to addTransportAddress.
public class ElasticTest {
public static void main(String args) {
Settings settings = ImmutableSettings.settingsBuilder() //
.put("cluster.name", "hotels") //
.put("client.transport.sniff", false) //
.build();
TransportClient client = new TransportClient(settings);
InetSocketTransportAddress transAddress = new
InetSocketTransportAddress("linux-dev", 9200);
client.addTransportAddress(transAddress);
client.close();
}
}
I have tried debugging it and hanging in
org.elasticsearch.client.transport.TransportClientNodeService on line
176 (stack copied below). Do you know what I might be doing wrong?
I had the same problem and eventually found that I had to use port 9300.
Le 21/06/2011 14:51, Rob Young a crit :
I have set up and started an Elasticsearch node and confirmed it's
working with a couple of Python scripts. I have indexed a bunch of
documents and am able to search over them. However, I am having
trouble getting the Java client API working. So far I just have a very
simple class that attempts to connect to the server with a
TransportClient but it's hanging on the call to addTransportAddress.
public class ElasticTest {
public static void main(String args) {
Settings settings = ImmutableSettings.settingsBuilder() //
.put("cluster.name", "hotels") //
.put("client.transport.sniff", false) //
.build();
TransportClient client = new TransportClient(settings);
InetSocketTransportAddress transAddress = new
InetSocketTransportAddress("linux-dev", 9200);
client.addTransportAddress(transAddress);
client.close();
}
}
I have tried debugging it and hanging in
org.elasticsearch.client.transport.TransportClientNodeService on line
176 (stack copied below). Do you know what I might be doing wrong?
9200 is for http transport, 9500 for thrift transport, and 9300 for ES's
"internal" transport, ie a protocol which only the ES server and clients
speak
Further to what Clint said, you can find out exactly which addresses
and ports are being used by the nodes by using the http API to
retrieve the node information:
curl -XGET http://localhost:9200/_cluster/nodes
This returns the node information in json format and the address and
port which the node has published for internal transport is shown as
e.g. "transport_address":"inet[/127.0.0.1:9300]". Alternatively if you
are using an admin client e.g. http://mobz.github.com/elasticsearch-head/
then you can use that to query the cluster nodes information.
On Tue, 2011-06-21 at 06:37 -0700, Rob Young wrote:
Thank you Cédric, that has indeed fixed the problem. Can anyone tell
me why Python connects on port 9200 but Java connects on port 9300?
9200 is for http transport, 9500 for thrift transport, and 9300 for ES's
"internal" transport, ie a protocol which only the ES server and clients
speak
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.