mozilla-services/heka — pull request #1185 by validname (2014-11-10 04:41:48+00:00)
Title: Improve error reporting from ElasticSearch output

Hello!

My patch solves two tasks:
1. It returns timeout error when it was exactly timeout error.
2. It returns error which ES server reports within JSON.
I figured out, that ES server doesn't report errors as HTTP status code. For example, this is network response from my ES server:
```
HTTP/1.1 200 OK.
Content-Type: application/json; charset=UTF-8.
Content-Length: 333.
.
{"took":60000,"errors":true,"items":[{"create":{"_index":"logstash-2014.10.02","_type":"log.nginx_access","_id":"gFsWQ9ZkSQykVZelQSkrWg","status":503,"error":"UnavailableShardsException[[logstash-2014.10.02][3] [2] shardIt, [0] active : Timeout waiting for [1m], request: org.elasticsearch.action.bulk.BulkShardRequest@789439dc]"}}]}
```
As you can see, we have 200 as HTTP status code, but "errors" field indicates about error.