Logstash aggregate field and increase count

The way you are using timeout_task_id_field means [message] will be preserved. If you want the count in a different field then remove the timeout_code option and change the code option to be

code => '
    map["message_count"] ||= 0
    map["message_count"] += 1
'