Update Elasticsearch Output Plugin to retry bulk

Some actions may fail within the ES client bulk call.
Now, some messages (specifically errors 429 and 503s) will be
retried up to 3 times. If there are still actions that are
unsuccessfully indexed, Stud Buffer will continue its current
behavior (to retry indefinitely).

Stud Buffer will replay all events it first attempted to flush
to Elasticsearch. This means duplicate events may find themselves
in Elasticsearch.

(migrated from https://github.com/elasticsearch/logstash/pull/1997 with a few modifications to make 
tests run once plugin is installed)
did you mean having `return nil` returning from the method or having nil as the map block result? I assume the latter since you call `compact` at the end. In this case the `return nil` will return from the function. I'd suggest rewriting this as
```ruby
buffer = @retry_queue.size.times.map do
  next_action, next_doc, next_event = @retry_queue.pop
  next_event['@metadata']['retry_count'] += 1

  if next_event['@metadata']['retry_count'] > @max_retries
    @logger.error("too many attempts at sending event. dropping: #{next_event}")
    next
  end

  [next_action, next_doc, next_event]
end.compact
```

`next` returns from the block. you can specify a return value to next, but a bare `next` is equivalent to `next nil`.