Commit 4767ac69 authored by Mark Chao's avatar Mark Chao

ES: Keep monkey-patch up-to-date with 6.1

https://github.com/elastic/elasticsearch-rails/pull/862
parent a917f8ca
......@@ -24,6 +24,8 @@ module GemExtensions
)
end
# Code copied from gem, to disable checks
# rubocop:disable Style/MultilineIfModifier
def update_document(options = {})
if attributes_in_database = self.instance_variable_get(:@__changed_model_attributes).presence
attributes = if respond_to?(:as_indexed_json)
......@@ -35,13 +37,14 @@ module GemExtensions
client.update(
{ index: index_name,
type: document_type,
id: self.es_id,
id: self.es_id, # Changed
body: { doc: attributes } }.merge(options)
)
) unless attributes.empty?
else
index_document(options)
end
end
# rubocop:enable Style/MultilineIfModifier
def update_document_attributes(attributes, options = {})
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