diff options
author | Claire <claire.github-309c@sitedethib.com> | 2023-01-18 16:21:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-18 16:21:48 +0100 |
commit | 41517a484506796f09610b79c59f91723e2fd662 (patch) | |
tree | 3e390576ecdf35e9282d2520486b887ed06758a0 | |
parent | fcc4c9b34a6ab771c9cef6673e817866773e12d0 (diff) |
Fix spurious admin dashboard warning when using ElasticSearch 7.x (#23064)
Some 7.x ElasticSearch versions support some 6.x nodes, thus the version check is inadequate. I am not sure there is a good way to check if a server implements all the 7.x APIs, so check server version and minimum wire version instead.
-rw-r--r-- | app/lib/admin/system_check/elasticsearch_check.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/lib/admin/system_check/elasticsearch_check.rb b/app/lib/admin/system_check/elasticsearch_check.rb index 7f922978f..5b4c12399 100644 --- a/app/lib/admin/system_check/elasticsearch_check.rb +++ b/app/lib/admin/system_check/elasticsearch_check.rb @@ -30,19 +30,24 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck def running_version @running_version ||= begin - Chewy.client.info['version']['minimum_wire_compatibility_version'] || - Chewy.client.info['version']['number'] + Chewy.client.info['version']['number'] rescue Faraday::ConnectionFailed nil end end + def compatible_wire_version + Chewy.client.info['version']['minimum_wire_compatibility_version'] + end + def required_version '7.x' end def compatible_version? return false if running_version.nil? - Gem::Version.new(running_version) >= Gem::Version.new(required_version) + + Gem::Version.new(running_version) >= Gem::Version.new(required_version) || + Gem::Version.new(compatible_wire_version) >= Gem::Version.new(required_version) end end |