Multiple Indices in Output not working

Based on the [type], matched events should be stored under "iislogs" index, but it is getting stored into "logstash" index.

What am I doing wrong here ?

input
{
file
{
type => "IISLogs"
path => "C:/IISLogs/*"
}
}
output
{
if[type] == "IISLogs"
{
elasticsearch
{
index => "iislogs-%{+YYYY.MM.dd}"
hosts => ["localhost:9200"]
}
}
else
{
elasticsearch
{
index => "logstash-%{+YYYY.MM.dd}"
hosts => ["localhost:9200"]
}
}
stdout
{
codec => rubydebug
}
}

If you show an example message that gets stored in the wrong place maybe we can help. For example, show us the output of the stdout output.

It was my mistake. I had renamed type to Type. I corrected that and it worked fine.