Use map field as index name

In my logstash config file

map['first_name'] ||= event.get('first_name') .

when i try to use that as my index
index => "%{first_name}"

index doesn't create.