Created
November 2, 2015 17:11
-
-
Save vinhboy/ce1dd59b3d975f071b1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How use this?