From 70c37b1393be58170f01e08b9048c2198b1386e8 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Thu, 5 Aug 2021 10:49:01 -0700 Subject: [PATCH] Fixed error with debug option with elasticsearch-ruby 7.14 --- CHANGELOG.md | 1 + lib/searchkick/query.rb | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66dd33e..ce7b1e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Fixed error with reindex queue - Fixed error with `model_name` method with multiple models +- Fixed error with `debug` option with elasticsearch-ruby 7.14 ## 4.5.1 (2021-08-03) diff --git a/lib/searchkick/query.rb b/lib/searchkick/query.rb index f943376..95e6a6f 100644 --- a/lib/searchkick/query.rb +++ b/lib/searchkick/query.rb @@ -109,7 +109,12 @@ module Searchkick request_params = query.except(:index, :type, :body) # no easy way to tell which host the client will use - host = Searchkick.client.transport.hosts.first + host = + if Elasticsearch::VERSION.to_f >= 7.14 + Searchkick.client.transport.transport.hosts.first + else + Searchkick.client.transport.hosts.first + end credentials = host[:user] || host[:password] ? "#{host[:user]}:#{host[:password]}@" : nil params = ["pretty"] request_params.each do |k, v| -- libgit2 0.21.0