Last active
October 4, 2017 15:22
-
-
Save tadyjp/c5afbd85fd00e6f91d3deba7c20a38c1 to your computer and use it in GitHub Desktop.
AWS Elasticsearch Serviceが律儀にgzipを返すようになって死んだ [解決済み] ref: http://qiita.com/tady/items/eb924cc06e8c1ed5ae9a
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
Elasticsearch::Model.client = Elasticsearch::Client.new( | |
host: ENV.fetch('ELASTICSEARCH_ENDPOINT'), | |
port: 80 | |
) do |faraday| | |
faraday.use FaradayMiddleware::Gzip # ここを追加 | |
faraday.request :aws_signers_v4, | |
credentials: Aws::Credentials.new(ENV.fetch('AWS_KEY_ID'), ENV.fetch('AWS_ACCESS_KEY')), | |
service_name: 'es', | |
region: 'ap-northeast-1' | |
faraday.adapter Faraday.default_adapter | |
end | |
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
MultiJson::ParseError: unexpected character at line 1, column 1 [parse.c:664] |
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
elasticsearch (5.0.0) | |
elasticsearch-api (5.0.0) | |
elasticsearch-transport (5.0.0) | |
elasticsearch-dsl (0.1.4) | |
elasticsearch-model (0.1.9) | |
elasticsearch-rails (0.1.9) | |
elasticsearch-transport (5.0.0) | |
faraday (0.9.2) | |
faraday_middleware (0.12.2) | |
faraday_middleware-aws-signers-v4 (0.1.5) | |
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
# This middleware is NOT necessary when these adapters are used: | |
# - net_http on Ruby 1.9+ | |
# - net_http_persistent on Ruby 2.0+ | |
# - em_http |
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
if Net::HTTP::HAVE_ZLIB | |
env.request_headers['Accept-Encoding'] ||= 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3' | |
end |
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
... | |
gem 'faraday_middleware' | |
... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment