LoginSignup
0
1

More than 5 years have passed since last update.

Amazon Elasticsearch ServiceにRailsからアクセスしたとき400エラーが起きる

Posted at

AWS上にRails, Elasticsearchの環境を作ろうとしたとき👇のようなエラーが起きた。

<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>

原因

ちゃんと設定してなかっただけです。
elasticsearch-railselasticsearch-rubyを利用しているので下のようにそれに従います。

elasticsearch-ruby - Elasticsearch::Transport
自分の環境ではポートの設定を追記。

elasticsearch.rb
Elasticsearch::Model.client = Elasticsearch::Client.new(
    {
        log: true,
        hosts: {
            host: 'xxxxxxxxxxxxxxxxxxxxx.ap-northeast-1.es.amazonaws.com',
            port: '80'
        }
    }
)

他にもElasticSearchのドメインをPublicではなく、
認証付きで作成していたりすると他にも設定を追記する必要があります。

それでは楽しいESライフを😪

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1