Method: ElasticRecord::Callbacks#as_partial_update_document

Defined in:
lib/elastic_record/callbacks.rb

#as_partial_update_documentObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/elastic_record/callbacks.rb', line 38

def as_partial_update_document
  json = {}

  mappings = elastic_index.mapping[:properties]
  changed.each do |field|
    if field_mapping = mappings[field]
      json[field] = elastic_search_value field, field_mapping
    end
  end

  amend_partial_update_document(json) if respond_to?(:partial_update_document)

  json
end