How do I configure Elastic search endpoint in java code?

Hi,
While creating lambda function we have sample blueprint for node js, python but not for java.
I want to connect to my domain (which is created in AWS Elastic search service) by using my java program.
Here I have endpoint for my domain. So how do I configure this in my java code. ?

Kindly respond it as early as possible.

Thanking you in anticipation....

My code is as below.

public class StreamTransferService{
public static void main(String[] args) {
System.out.println("-1");
Client client = null;
Settings set= Settings.settingsBuilder().put("cluster.name", "xxxxxx")
.put("number_of_shards", 1)
.put("number_of_replicas", 1)
.build();

    client = TransportClient.builder().settings(set).build();                 
    try {
        client = TransportClient.builder().build()                   
        		.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("search-xxxxxxxxx-xxxxxoxrhbaia.us-west-2.es.amazonaws.com"), 80));
   
    } catch (UnknownHostException e) {        	
        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
    }        
    String indexName="all_products";
  
	CreateIndexResponse response = client.admin().indices().create(new CreateIndexRequest(indexName)).actionGet();
	
	if (!response.isAcknowledged()) {
		throw new RuntimeException("cannot create index " + indexName);
	}		
	client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();				
}

}

Disclaimer: I work for Elastic, the company behind Elasticsearch and also Elastic Cloud

Hi @Vinayak_Fulari,

As stated in Amazon's Elasticsearch service documentation you're out of luck:

The service supports HTTP on port 80, but does not support TCP transport.

If you are looking for an alternative that supports this, you can give Elastic Cloud a go.

Daniel