Reputation: 593
[UPDATE] I just add the current endpoint for this case (for a few days)
I'm using ElasticSearch with Rails, I'm using this gems: - elasticsearch-rails - elasticsearch-model
When I run elasticsearch in my development (My computer) my setting is ok. But when I use the endpoint for Elasticsearch AWS appear this message in my rails app:
"Faraday::TimeoutError: Connection timed out - connect for search-production-shipit-45cu5wkligv2ythnfozcnthsoi.us-east-1.es.amazonaws.com port 9200"
I added this file in my initializer: elasticsearch.rb
Elasticsearch::Model.client = Elasticsearch::Client.new host: "search-production-shipit-45cu5wkligv2ythnfozcnthsoi.us-east-1.es.amazonaws.com"
When I enter in my endpoint show elasticsearch information ok.
This is my policy in Amazon Elasticsearch (Anyone can connect for this example)
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "es:*",
"Resource": "arn:aws:es:us-east-1:090358380644:domain/production-shipit/*"
}
]
}
On the other hand, when I execute this command:
curl -XGET 'search-production-shipit-45cu5wkligv2ythnfozcnthsoi.us-east-1.es.amazonaws.com'
The endpoint return this:
{
"status" : 200,
"name" : "Meld",
"cluster_name" : "090358380644:production-shipit",
"version" : {
"number" : "1.5.2",
"build_hash" : "62ff9868b4c8a0c45860bebb259e21980778ab1c",
"build_timestamp" : "2015-04-27T09:21:06Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}
Upvotes: 1
Views: 1241
Reputation: 84182
The Amazon hosted elasticsearch changes the default port from 9200 to the default http/https ports (80 and 443) - note how your curl command doesn't specify a port
On the other hand the elasticsearch ruby libraries assume the elasticsearch default of 9200. You can specify the port by specify a URL (with the url
option) or with
Elasticsearch::Client.new hosts: [
{ host: 'some-host',
port: '443',
scheme: 'https'
} ]
Upvotes: 6