code: @Override
    public boolean write(SimpleDataEvent event) {
      events.add(event);
      if (events.size() >= bulkSize) {
        List<SimpleDataEvent> eventsCopy = new ArrayList<SimpleDataEvent>(this.events);
        events.clear();
        LOG.info("Sending ES bulk index event with " + eventsCopy.size() + " events");
        HttpPost postMethod = new HttpPost(esBaseUrl + "/" + ES_BULK_END_POINT);
        StringEntity postEntity;
        TimerContext timerContext = null;
        try {
          postEntity = new StringEntity(getBulkData(eventsCopy), "UTF-8");
          postMethod.setEntity(postEntity);
          postMethod.expectContinue();
          timerContext = startRequestTimer();
          boolean returnValue = execute(postMethod);
          return returnValue;
        } catch (UnsupportedEncodingException uee) {
          LOG.error("Error sending event: " + uee);
          return false;
        } finally {
          if (timerContext != null) {
            stopRequestTimer(timerContext);
          }
        }
      }
      return true;
    }
docs: (non-Javadoc)
  
  @see com.sematext.ag.es.sink.SimpleJSONDataESSink#write(com.sematext.ag.event.SimpleDataEvent)