RestHighLevelClient client = new RestHighLevelClient(
RestClient.builder(
new HttpHost("localhost", 9200, "http"),
new HttpHost("localhost", 9201, "http")));
It's just an example to show connecting to multiple different ports. If you run 2 elasticsearch nodes on your local machine one of them will listen on 9200 and the other will listen on 9201.
By default, Elasticsearch opens 2 ports on each node. 9200 is the HTTP (Rest) port 9300 is the transport (node-to-node communictation) port.
By default if those ports are already in use, it will try to use the next available port (9201 or 9301).
You can configure those port numbers with the following settings.
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.