I am able to access the ElasticSearch via http://127.0.0.1:9200 , however when trying to connect from the same machine via RestHighLevelClient I get the java.net.ConnectException: Connection refused.
try { final BulkResponse response=this.restHighLevelClient.bulk(bulkRequest); } catch (final IOException exn) { LOG.error("Bulk insert failed", exn); }
The configuration class for Elastic search client is like below.
@Bean public RestHighLevelClient restClient() { return new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", "9200", "http"))); }
I have retained the default settings in elastic-search.yml file and debugged to be sure that host and port are correct. Any ideas please?
我有同样的问题,但是我的问题是我错误地连接到错误的主机。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.