Lowercase a field's value

I am trying to lowercase the value of only 1 filed in logstash. From the old threads, i see that the lowercase filter does not help. So, i tried using

ruby {
code => "event.to_hash.each{|k, v| v.downcase! if v.is_a?(String)}"

But the above lowercases all fields.

If i try using event['field'].to... ==> i get the error
Ruby exception occurred: undefined method `to_hash' for nil:NilClass {:level=>:error, :file=>"logstash/filters/ruby.rb", :line=>"41", :method=>"filter"}

How can i lowercase the value of ONLY one field after i parse the message?

Please let me know.


with the new logstash release, lowercase works fine.