Commit a25bac1f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch '32539-update-elasticsearch-gems-to-v6' into 'master'

Upgrade elasticsearch gems to v6

See merge request gitlab-org/gitlab!22645
parents aec47fad 4767ac69
...@@ -129,9 +129,9 @@ gem 'unf', '~> 0.1.4' ...@@ -129,9 +129,9 @@ gem 'unf', '~> 0.1.4'
gem 'seed-fu', '~> 2.3.7' gem 'seed-fu', '~> 2.3.7'
# Search # Search
gem 'elasticsearch-model', '~> 0.1.9' gem 'elasticsearch-model', '~> 6.1'
gem 'elasticsearch-rails', '~> 0.1.9', require: 'elasticsearch/rails/instrumentation' gem 'elasticsearch-rails', '~> 6.1', require: 'elasticsearch/rails/instrumentation'
gem 'elasticsearch-api', '5.0.3' gem 'elasticsearch-api', '~> 6.8'
gem 'aws-sdk' gem 'aws-sdk'
gem 'faraday_middleware-aws-signers-v4' gem 'faraday_middleware-aws-signers-v4'
......
...@@ -235,17 +235,17 @@ GEM ...@@ -235,17 +235,17 @@ GEM
doorkeeper (~> 4.3) doorkeeper (~> 4.3)
json-jwt (~> 1.6) json-jwt (~> 1.6)
ed25519 (1.2.4) ed25519 (1.2.4)
elasticsearch (5.0.3) elasticsearch (6.8.0)
elasticsearch-api (= 5.0.3) elasticsearch-api (= 6.8.0)
elasticsearch-transport (= 5.0.3) elasticsearch-transport (= 6.8.0)
elasticsearch-api (5.0.3) elasticsearch-api (6.8.0)
multi_json multi_json
elasticsearch-model (0.1.9) elasticsearch-model (6.1.0)
activesupport (> 3) activesupport (> 3)
elasticsearch (> 0.4) elasticsearch (> 1)
hashie hashie
elasticsearch-rails (0.1.9) elasticsearch-rails (6.1.0)
elasticsearch-transport (5.0.3) elasticsearch-transport (6.8.0)
faraday faraday
multi_json multi_json
email_reply_trimmer (0.1.6) email_reply_trimmer (0.1.6)
...@@ -270,7 +270,7 @@ GEM ...@@ -270,7 +270,7 @@ GEM
factory_bot_rails (5.1.0) factory_bot_rails (5.1.0)
factory_bot (~> 5.1.0) factory_bot (~> 5.1.0)
railties (>= 4.2.0) railties (>= 4.2.0)
faraday (0.12.2) faraday (0.15.4)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
faraday-http-cache (2.0.0) faraday-http-cache (2.0.0)
faraday (~> 0.8) faraday (~> 0.8)
...@@ -478,7 +478,7 @@ GEM ...@@ -478,7 +478,7 @@ GEM
tilt tilt
hangouts-chat (0.0.5) hangouts-chat (0.0.5)
hashdiff (0.3.8) hashdiff (0.3.8)
hashie (3.5.7) hashie (3.6.0)
hashie-forbidden_attributes (0.1.1) hashie-forbidden_attributes (0.1.1)
hashie (>= 3.0) hashie (>= 3.0)
health_check (2.6.0) health_check (2.6.0)
...@@ -506,7 +506,7 @@ GEM ...@@ -506,7 +506,7 @@ GEM
mime-types (~> 3.0) mime-types (~> 3.0)
multi_xml (>= 0.5.2) multi_xml (>= 0.5.2)
httpclient (2.8.3) httpclient (2.8.3)
i18n (1.7.0) i18n (1.7.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
i18n_data (0.8.0) i18n_data (0.8.0)
icalendar (2.4.1) icalendar (2.4.1)
...@@ -615,9 +615,9 @@ GEM ...@@ -615,9 +615,9 @@ GEM
mini_portile2 (2.4.0) mini_portile2 (2.4.0)
minitest (5.11.3) minitest (5.11.3)
msgpack (1.3.1) msgpack (1.3.1)
multi_json (1.13.1) multi_json (1.14.1)
multi_xml (0.6.0) multi_xml (0.6.0)
multipart-post (2.0.0) multipart-post (2.1.1)
murmurhash3 (0.1.6) murmurhash3 (0.1.6)
mustermann (1.0.3) mustermann (1.0.3)
mustermann-grape (1.0.0) mustermann-grape (1.0.0)
...@@ -1048,7 +1048,7 @@ GEM ...@@ -1048,7 +1048,7 @@ GEM
truncato (0.7.11) truncato (0.7.11)
htmlentities (~> 4.3.1) htmlentities (~> 4.3.1)
nokogiri (>= 1.7.0, <= 2.0) nokogiri (>= 1.7.0, <= 2.0)
tzinfo (1.2.5) tzinfo (1.2.6)
thread_safe (~> 0.1) thread_safe (~> 0.1)
u2f (0.2.1) u2f (0.2.1)
uber (0.1.0) uber (0.1.0)
...@@ -1173,9 +1173,9 @@ DEPENDENCIES ...@@ -1173,9 +1173,9 @@ DEPENDENCIES
doorkeeper (~> 4.3) doorkeeper (~> 4.3)
doorkeeper-openid_connect (~> 1.5) doorkeeper-openid_connect (~> 1.5)
ed25519 (~> 1.2) ed25519 (~> 1.2)
elasticsearch-api (= 5.0.3) elasticsearch-api (~> 6.8)
elasticsearch-model (~> 0.1.9) elasticsearch-model (~> 6.1)
elasticsearch-rails (~> 0.1.9) elasticsearch-rails (~> 6.1)
email_reply_trimmer (~> 0.1) email_reply_trimmer (~> 0.1)
email_spec (~> 2.2.0) email_spec (~> 2.2.0)
escape_utils (~> 1.1) escape_utils (~> 1.1)
......
...@@ -24,6 +24,8 @@ module GemExtensions ...@@ -24,6 +24,8 @@ module GemExtensions
) )
end end
# Code copied from gem, to disable checks
# rubocop:disable Style/MultilineIfModifier
def update_document(options = {}) def update_document(options = {})
if attributes_in_database = self.instance_variable_get(:@__changed_model_attributes).presence if attributes_in_database = self.instance_variable_get(:@__changed_model_attributes).presence
attributes = if respond_to?(:as_indexed_json) attributes = if respond_to?(:as_indexed_json)
...@@ -35,13 +37,14 @@ module GemExtensions ...@@ -35,13 +37,14 @@ module GemExtensions
client.update( client.update(
{ index: index_name, { index: index_name,
type: document_type, type: document_type,
id: self.es_id, id: self.es_id, # Changed
body: { doc: attributes } }.merge(options) body: { doc: attributes } }.merge(options)
) ) unless attributes.empty?
else else
index_document(options) index_document(options)
end end
end end
# rubocop:enable Style/MultilineIfModifier
def update_document_attributes(attributes, options = {}) def update_document_attributes(attributes, options = {})
client.update( client.update(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment