Fix/codec encode context

this fixes elasticsearch/logstash#1523