From c479fba6646c19d1d1f503398d94cdca4baca6ad Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 8 Mar 2018 16:54:51 +0100 Subject: [PATCH] Added check for supported elasticsearch version. --- lib/search_index_backend.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/search_index_backend.rb b/lib/search_index_backend.rb index 147bbce75..2b43e6ff1 100644 --- a/lib/search_index_backend.rb +++ b/lib/search_index_backend.rb @@ -26,7 +26,13 @@ info about used search index machine } ) Rails.logger.info "# #{response.code}" - return response.data if response.success? + if response.success? + installed_version = response.data.dig('version', 'number') + raise "Unable to get elasticsearch version from response: #{response.inspect}" if installed_version.blank? + version_supported = Gem::Version.new(installed_version) < Gem::Version.new('5.7') + raise "Version #{installed_version} of configured elasticsearch is not supported" if !version_supported + return response.data + end raise humanized_error( verb: 'GET',