lib/logstash/inputs/elasticsearch.rb in logstash-input-elasticsearch-2.0.5 vs lib/logstash/inputs/elasticsearch.rb in logstash-input-elasticsearch-3.0.0

- old
+ new

@@ -171,11 +171,11 @@ event = LogStash::Event.new(hit['_source']) decorate(event) if @docinfo # do not assume event[@docinfo_target] to be in-place updatable. first get it, update it, then at the end set it in the event. - docinfo_target = event[@docinfo_target] || {} + docinfo_target = event.get(@docinfo_target) || {} unless docinfo_target.is_a?(Hash) @logger.error("Elasticsearch Input: Incompatible Event, incompatible type for the docinfo_target=#{@docinfo_target} field in the `_source` document, expected a hash got:", :docinfo_target_type => docinfo_target.class, :event => event) # TODO: (colin) I am not sure raising is a good strategy here? @@ -184,10 +184,10 @@ @docinfo_fields.each do |field| docinfo_target[field] = hit[field] end - event[@docinfo_target] = docinfo_target + event.set(@docinfo_target, docinfo_target) end output_queue << event end