Create index dynamically

I want to create ES index in logstash conf file dynamically based on id,

if first character of id = 1 i need to create my index as 1_myindex

and if id = 2 create my index as 2_myindex.

Thanks