Skip to content

Instantly share code, notes, and snippets.

@vinhboy
Created November 2, 2015 17:11
Show Gist options
  • Save vinhboy/ce1dd59b3d975f071b1b to your computer and use it in GitHub Desktop.
Save vinhboy/ce1dd59b3d975f071b1b to your computer and use it in GitHub Desktop.
require 'faraday_middleware/aws_signers_v4'
transport_configuration = lambda do |f|
f.request :aws_signers_v4,
credentials: Aws::Credentials.new(ENV['AWS_ELASTICSEARCH_KEY'], ENV['AWS_ELASTICSEARCH_SECRET']),
service_name: 'es',
region: 'us-east-1'
f.response :logger
f.adapter Faraday.default_adapter
end
transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new \
hosts: [{ scheme: 'https', host: ENV['AWS_ELASTICSEARCH_HOST'], port: '443' }],
&transport_configuration
Elasticsearch::Model.client = Elasticsearch::Client.new transport: transport
@luiszacheu
Copy link

How use this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment