Commit ff32396b9261b5f9b88960d16f992a1bbad8ea97
1 parent
05ddfb45
Exists in
master
and in
21 other branches
Added intstructions for AWS signed requests - #574
Showing
1 changed file
with
25 additions
and
5 deletions
Show diff stats
README.md
@@ -922,18 +922,38 @@ heroku run rake searchkick:reindex CLASS=Product | @@ -922,18 +922,38 @@ heroku run rake searchkick:reindex CLASS=Product | ||
922 | 922 | ||
923 | ### Amazon Elasticsearch Service | 923 | ### Amazon Elasticsearch Service |
924 | 924 | ||
925 | -You must use an [IP-based access policy](http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-gsg-search.html) for Searchkick to work. | ||
926 | - | ||
927 | -Include `elasticsearch 1.0.14` or greater in your Gemfile. | 925 | +Include `elasticsearch 1.0.15` or greater in your Gemfile. |
928 | 926 | ||
929 | ```ruby | 927 | ```ruby |
930 | -gem "elasticsearch", ">= 1.0.14" | 928 | +gem "elasticsearch", ">= 1.0.15" |
931 | ``` | 929 | ``` |
932 | 930 | ||
933 | Create an initializer `config/initializers/elasticsearch.rb` with: | 931 | Create an initializer `config/initializers/elasticsearch.rb` with: |
934 | 932 | ||
935 | ```ruby | 933 | ```ruby |
936 | -ENV["ELASTICSEARCH_URL"] = "http://es-domain-1234.us-east-1.es.amazonaws.com" | 934 | +ENV["ELASTICSEARCH_URL"] = "https://es-domain-1234.us-east-1.es.amazonaws.com" |
935 | +``` | ||
936 | + | ||
937 | +To use signed request, include in your Gemfile: | ||
938 | + | ||
939 | +```ruby | ||
940 | +gem 'faraday_middleware-aws-signers-v4' | ||
941 | +``` | ||
942 | + | ||
943 | +and add your initializer: | ||
944 | + | ||
945 | +```ruby | ||
946 | +Searchkick.client = | ||
947 | + Elasticsearch::Client.new( | ||
948 | + url: ENV["ELASTICSEARCH_URL"], | ||
949 | + transport_options: {request: {timeout: 10}} | ||
950 | + ) do |f| | ||
951 | + f.request :aws_signers_v4, { | ||
952 | + credentials: Aws::Credentials.new(ENV["AWS_ACCESS_KEY_ID"], ENV["AWS_SECRET_ACCESS_KEY"]), | ||
953 | + service_name: "es", | ||
954 | + region: "us-east-1" | ||
955 | + } | ||
956 | + end | ||
937 | ``` | 957 | ``` |
938 | 958 | ||
939 | Then deploy and reindex: | 959 | Then deploy and reindex: |