Update elasticsearch output to respect the 'index' in templates

Now the elasticsearch output plugin will respect the
'index' plugin setting and override the default index
template to update the indexes it matches on based on
the 'index' setting.

Any placeholders ("%{...}") will be translated to '*' so the
template matching pattern is generic and in line with elasticsearch
wildcarding.

e.g

index: "newindex-%{YYYY}" will update template to include...
```
{
template: "newindex-*"
...
}
```
the gsub matches `%{*}`. It leaves dashes alone

btw. this regex is courtesy of @jordansissel, thanks!