user3346601
user3346601

Reputation: 1049

elastic4s with Amazon Elasticsearch Service

I'm using elastic4s in my scala project to communicate with ElasticSearch. For development I started a local node and everything is working fine. For production, I would like to use Amazon Elasticsearch Service. I've configured that service and allowed access to it via the ip of my ec2 instance. I can verify that it works by ssh-ing into ec2 and doing:

curl search-blabla-blabla.us-east-1.es.amazonaws.com/_cluster/health

However, I am having trouble connecting elastic4s to that ES instance. I'm trying:

ElasticClient.remote("search-blabla-blabla.us-east-1.es.amazonaws.com", 9300)

which results in:

org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []

Reading the docs, it appears that elastic4s can only connect via TCP [1] and Amazon Elasticsearch Service does not support TCP[2]: The service supports HTTP on port 80, but does not support TCP transport.

Could someone confirm that elastic4s and Amazon ES really don't work together? Because that would mean I have to re-write all of my ES code.

Upvotes: 2

Views: 929

Answers (1)

sksamuel
sksamuel

Reputation: 16387

Amazon's Elasticsearch service does not support TCP, just the HTTP protocol. Elastic4s uses TCP only, as does the Elasticsearch Java API (Elastic4s being a wrapper around the Java client).

If you want to use HTTP you'll need to write the queries by hand and use a regular HTTP client, or use an Elasticsearch client that supports the HTTP protocol.

Update:

As of version 5.2, elastic4s supports HTTP as well as TCP. This is currently experimental. https://github.com/sksamuel/elastic4s#quick-start

Upvotes: 2

Related Questions