2
votes

I play with ElasticSearch REST API via 9200 port.

Official Java library client connect to 9300 port.

What is the difference between port API?

I want to pass logging events into ElasticSearch and look to Bulk API:

What bother me the most is that Java API through PreBuiltTransportClient bring a lot of dependencies that is totally unnecessary overhead if plug Client into application (why I need org.apache.lucene jars in app??).

Is there any performance difference, do they provide same level of reliability?

2

2 Answers

5
votes

Here

java client creates a transport node client for elastic and connects to cluster(not as fully functional node) through transport module instead of working neatly on 9200 port. So it fallbacks to port 9300 to connect to transport layer of ES.

TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host1"), 9300))
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host2"), 9300));

Elastic listen for all transport request at port 9300, even other nodes.

1
votes

If you're using Java, you can use the Transport Client to talk to Elasticsearch on port 9300 using the binary protocol. The Transport Client is now deprecated - you should use the REST API anyway because it has better backwards compatibility and there's no significant performance benefit anyway.