Commit 75fae6a52b8929271b6868d29e3c16284f0cd0e5

Authored by Andrew Kane
1 parent 49953882
Exists in master

Fixed search timeout with elasticsearch 8+ and opensearch-ruby gems - #1593

Showing 2 changed files with 5 additions and 1 deletions   Show diff stats
  1 +## 5.1.0 (unreleased)
  2 +
  3 +- Fixed search timeout with `elasticsearch` 8+ and `opensearch-ruby` gems
  4 +
1 ## 5.0.5 (2022-10-09) 5 ## 5.0.5 (2022-10-09)
2 6
3 - Added `model` method to `Searchkick::Relation` 7 - Added `model` method to `Searchkick::Relation`
lib/searchkick/middleware.rb
@@ -3,7 +3,7 @@ require "faraday" @@ -3,7 +3,7 @@ require "faraday"
3 module Searchkick 3 module Searchkick
4 class Middleware < Faraday::Middleware 4 class Middleware < Faraday::Middleware
5 def call(env) 5 def call(env)
6 - if env[:method] == :get && env[:url].path.to_s.end_with?("/_search") 6 + if env[:url].path.to_s.end_with?("/_search")
7 env[:request][:timeout] = Searchkick.search_timeout 7 env[:request][:timeout] = Searchkick.search_timeout
8 end 8 end
9 @app.call(env) 9 @app.call(env)