lib/searchkick.rb in searchkick-4.4.4 vs lib/searchkick.rb in searchkick-4.5.0

- old
+ new

@@ -72,14 +72,27 @@ def self.search_timeout (defined?(@search_timeout) && @search_timeout) || timeout end + # private + def self.server_info + @server_info ||= client.info + end + def self.server_version - @server_version ||= client.info["version"]["number"] + @server_version ||= server_info["version"]["number"] end + def self.opensearch? + unless defined?(@opensearch) + @opensearch = server_info["version"]["distribution"] == "opensearch" + end + @opensearch + end + def self.server_below?(version) + server_version = opensearch? ? "7.10.2" : self.server_version Gem::Version.new(server_version.split("-")[0]) < Gem::Version.new(version.split("-")[0]) end # memoize for performance def self.server_below7?