Added check for supported elasticsearch version.

This commit is contained in:
Thorsten Eckel 2018-03-08 16:54:51 +01:00
parent 8c5f87c9d4
commit c479fba664

View file

@ -26,7 +26,13 @@ info about used search index machine
} }
) )
Rails.logger.info "# #{response.code}" 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( raise humanized_error(
verb: 'GET', verb: 'GET',