Hello
Can anyone please help me with an issue I am facing with regards to connecting to elasticsearch hosted on AWS. I am using the High level Rest client to make requests and running the java application as Jar.
Error that I am currently running into:
java.net.ConnectException: Connection refused
at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:943)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:227)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1256)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1231)
at org.elasticsearch.client.RestHighLevelClient.get(RestHighLevelClient.java:416)
at org.onlineadvocate.elasticload.LoadTimeService.getLoadTime(LoadTimeService.java:82)
at org.onlineadvocate.elasticload.ElasticSearchLoader.getLastLoadTime(ElasticSearchLoader.java:48)
at org.onlineadvocate.elasticload.ElasticSearchLoader.loadSiteResourcesIntoElastic(ElasticSearchLoader.java:35)
at org.onlineadvocate.elasticload.SiteLoader.loadSites(SiteLoader.java:50)
at org.onlineadvocate.elasticload.SiteLoaderMain.main(SiteLoaderMain.java:28)
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:171)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:145)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:348)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:192)
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
at java.lang.Thread.run(Thread.java:748)
However, I was able to successfully make curl requests from the EC2 instance and receive successful response.
Thanks for your help.