Delete events with id > `start_id` and end_time <= `end_time`.

def _delete(self, namespace, stream, start_id, end_time, configuration):
    """
    Delete events with id > `start_id` and end_time <= `end_time`.
    """
    start_time = uuid_to_kronos_time(start_id)
    body_query = {
      'query': {
        'filtered': {
          'query': {'match_all': {}},
          'filter': {
            'bool': {
              'should': [
                {
                  'range': {TIMESTAMP_FIELD: {'gt': start_time,
                                              'lte': end_time}}
                },
                {
                  'bool': {
                    'must': [
                      {'range': {ID_FIELD: {'gt': str(start_id)}}},
                      {'term': {TIMESTAMP_FIELD: start_time}}
                    ]
                  }
                }
              ]
            }
          }
        }
      }
    }
    query = {'index': self.index_manager.get_index(namespace),
             'doc_type': stream,
             'body': body_query,
             'ignore': 404,
             'allow_no_indices': True,
             'ignore_unavailable': True}
    try:
      # XXX: ElasticSearch does not return stats on deletions.
      # https://github.com/elasticsearch/elasticsearch/issues/6519
      count = self.es.count(**query).get('count', 0)
      if count:
        self.es.delete_by_query(**query)
      return count, []
    except Exception, e:
      return 0, [repr(e)]