The common filter option add_field will convert a string to an array if the field already exists, or append an entry to an array, then you can remove the last entry in the array.
mutate { add_field => { "foo" => 2 } }
mutate { remove_field => [ "[foo][-1]" ] }
You could also do it using a ruby filter, but I think this is harder to understand:
ruby { code => 'event.set("foo", [ event.get("foo") ].flatten)' }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…