made the elasticsearch output more resilient for errors when determining the index

this helped with the bug https://logstash.jira.com/browse/LOGSTASH-1892
Merge branch 'feature/harden_elasticsearch_output'