Initializing a RestHighLevelClient for ElasticSearch

In the documentation here, they initialize an instance of the client with the following code:

RestHighLevelClient client = new RestHighLevelClient(
        RestClient.builder(
                new HttpHost("localhost", 9200, "http"),
                new HttpHost("localhost", 9201, "http")));

I've configured my ElasticSearch instance on the AWS Console following these instructions. On the summary page for my newly created instance, there is no port number with the domain.

So my question is, given how I've configured my instance how can I set up and make requests using a RestHighLevelClient if I'm not running the instance locally? I've tried

 RestHighLevelClient myRestHighLevelClient = new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost(ELASTIC_ENDPOINT_DEV)
                )
        );

        GetRequest getRequest = new GetRequest("myIndex", "myType","myID");
        myRestHighLevelClient.get(getRequest);

But I am returned with a java.net.ConnectionException: Connection Refused. Please help!

You should ask AWS support for this.

Did you look at https://www.elastic.co/cloud and https://aws.amazon.com/marketplace/pp/B01N6YCISK ?

Cloud by elastic is the only way to have access to X-Pack. Think about what is there yet like Security, Monitoring, Reporting and what is coming like Canvas, SQL... And 6.3.0 is yet available there!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.