Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elastic Transport client on AWS Managed ElasticSearch

I am trying to use the AWS Managed ElasticSearch for my project.

I have followed https://aws.amazon.com/blogs/aws/new-amazon-elasticsearch-service/ and i am able to start an instance and which is successfull. But I am unable to connect to the same instance from my service using elasticsearch transport client.

I know transport client supposed to connect on to the 9300 port, and that port i am unable to turn on through the aws console.

Here is the code that I am using to connect, which is successfully able to connect to my elastic search setup on an ec2 machine on the 9300 port.

ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
                    settings.put("cluster.name", "my-cluster-name")
                            .put("client.transport.nodes_sampler_interval", "15s")
                            .put("client.transport.ping_timeout", "15s")
                            .put("client.transport.sniff", true)
                            .put("client.transport.ignore_cluster_name", false).build();
                    client = new TransportClient(settings)
                        .addTransportAddress(
                            new InetSocketTransportAddress(
                                        env.getProperty("elastic-host-url-provided-by-aws",80)
                            ));

I am getting the Exception

org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [] at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:305) at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:200) at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106) at org.elasticsearch.client.support.AbstractClient.index(AbstractClient.java:98)

I suspect that this error is since I am connecting the TransportClient over the HTTP port. But I don't know, what is the TCP port for aws managed elastic search instance. I searched in aws documents, and i couldnt find any. If some have used TransportClient to connect with Amazon ES let me know.

NB: I have verified that the elasticsearch java jar version that I am using is as same as same with the server. And from my system I am able to access the Kibana and the ES HTTP PORTS with out any issue.

like image 478
Ysak Avatar asked Oct 22 '15 16:10

Ysak


People also ask

What is transport client Elasticsearch?

The TransportClient connects remotely to an Elasticsearch cluster using the transport module.

Is AWS OpenSearch compatible with Elasticsearch?

Amazon OpenSearch Service supports most of the commonly used OpenSearch and Elasticsearch APIs, so the code, applications, and popular tools that you're already using with your Elasticsearch (up to version 7.10) or OpenSearch environments work seamlessly.

Is OpenSearch fully managed?

Amazon OpenSearch Service is a fully managed service that makes it easy to deploy, operate, and scale OpenSearch (now supporting Apache Lucene 9) clusters securely and cost-effectively in the AWS Cloud.

Is OpenSearch same as Elasticsearch?

The Amazon Elasticsearch Service was renamed to Amazon OpenSearch Service on September 8th 2021 according to the official AWS open-source blog.


1 Answers

AWS related Forum link.

Here are the restrictions for AWS ElasticSearch service:

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

like image 148
Matt Avatar answered Oct 05 '22 01:10

Matt