Skip to content

Commit

Permalink
Revert "Upgrade elasticsearch gems and update development tracer conf…
Browse files Browse the repository at this point in the history
…iguration (#2963)"

This reverts commit c45be12.
Fixes:

Elasticsearch::UnsupportedProductError: The client noticed that the
server is not a supported distribution of Elasticsearch.

https://app.honeybadger.io/projects/40972/faults/84396370
  • Loading branch information
sonalkr132 committed Mar 7, 2022
1 parent dc2f541 commit f78892a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 47 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ gem "shoryuken", "~> 4.0", require: false
gem "statsd-instrument", "~> 2.3.0"
gem "unicorn", "~> 5.8.0"
gem "validates_formatting_of"
gem "elasticsearch-model", "~> 7.2"
gem "elasticsearch-rails", "~> 7.2"
gem "elasticsearch-model", "~> 7.0"
gem "elasticsearch-rails", "~> 7.0"
gem "elasticsearch-dsl", "~> 0.1.2"
gem "faraday_middleware-aws-sigv4", "~> 0.3"
gem "xml-simple"
Expand Down
50 changes: 14 additions & 36 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,19 @@ GEM
docile (1.3.4)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
elasticsearch (7.17.1)
elasticsearch-api (= 7.17.1)
elasticsearch-transport (= 7.17.1)
elasticsearch-api (7.17.1)
elasticsearch (7.5.0)
elasticsearch-api (= 7.5.0)
elasticsearch-transport (= 7.5.0)
elasticsearch-api (7.5.0)
multi_json
elasticsearch-dsl (0.1.10)
elasticsearch-model (7.2.1)
elasticsearch-model (7.1.1)
activesupport (> 3)
elasticsearch (~> 7)
elasticsearch (> 1)
hashie
elasticsearch-rails (7.2.1)
elasticsearch-transport (7.17.1)
faraday (~> 1)
elasticsearch-rails (7.1.1)
elasticsearch-transport (7.5.0)
faraday (>= 0.14, < 1)
multi_json
email_validator (2.2.3)
activemodel
Expand All @@ -162,30 +162,9 @@ GEM
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
faraday (1.10.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
faraday (0.17.4)
multipart-post (>= 1.2, < 3)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware-aws-sigv4 (0.6.1)
faraday_middleware-aws-sigv4 (0.5.0)
aws-sigv4 (~> 1.0)
faraday (>= 1.8, < 2)
ffi (1.15.5)
Expand All @@ -195,7 +174,7 @@ GEM
globalid (1.0.0)
activesupport (>= 5.0)
gravtastic (3.2.6)
hashie (5.0.0)
hashie (4.1.0)
high_voltage (3.1.2)
honeybadger (4.11.0)
http-accept (1.7.0)
Expand Down Expand Up @@ -387,7 +366,6 @@ GEM
ruby-graphviz (1.2.5)
rexml
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
sassc (2.4.0)
ffi (~> 1.9)
Expand Down Expand Up @@ -477,8 +455,8 @@ DEPENDENCIES
delayed_job
delayed_job_active_record
elasticsearch-dsl (~> 0.1.2)
elasticsearch-model (~> 7.2)
elasticsearch-rails (~> 7.2)
elasticsearch-model (~> 7.0)
elasticsearch-rails (~> 7.0)
factory_bot_rails
faraday_middleware-aws-sigv4 (~> 0.3)
gravtastic
Expand Down
16 changes: 7 additions & 9 deletions config/initializers/elasticsearch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,7 @@

url = ENV['ELASTICSEARCH_URL'] || "http://localhost:#{port}"

params = { url: url }

if Rails.env.development?
tracer = ActiveSupport::Logger.new('log/elasticsearch.log')
tracer.level = Logger::DEBUG
params.merge!(logger: tracer)
end

Elasticsearch::Model.client = Elasticsearch::Client.new(**params) do |f|
Elasticsearch::Model.client = Elasticsearch::Client.new(url: url) do |f|
if Rails.env.staging? || Rails.env.production?
f.request :aws_sigv4,
service: 'es',
Expand All @@ -33,3 +25,9 @@
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
end
end

if Rails.env.development?
tracer = ActiveSupport::Logger.new('log/elasticsearch.log')
tracer.level = Logger::DEBUG
Elasticsearch::Model.client.transport.tracer = tracer
end

0 comments on commit f78892a

Please sign in to comment.