code: def delete(self, start_date=None, end_date=None):
          
          aggs_query = Search(
              using=self.client,
              index=self.aggregation_alias,
              doc_type=self.aggregation_doc_type
          ).extra(_source=False)
  
          range_args = {}
          if start_date:
              range_args['gte'] = self._format_range_dt(
                  start_date.replace(microsecond=0))
          if end_date:
              range_args['lte'] = self._format_range_dt(
                  end_date.replace(microsecond=0))
          if range_args:
              aggs_query = aggs_query.filter('range', timestamp=range_args)
  
          bookmarks_query = Search(
              using=self.client,
              index=self.aggregation_alias,
              doc_type=self.bookmark_doc_type
          ).sort({'date': {'order': 'desc'}})
  
          if range_args:
              bookmarks_query = bookmarks_query.filter('range', date=range_args)
  
          def _delete_actions():
              for query in (aggs_query, bookmarks_query):
                  affected_indices = set()
                  for doc in query.scan():
                      affected_indices.add(doc.meta.index)
                      yield dict(_index=doc.meta.index,
                                 _op_type='delete',
                                 _id=doc.meta.id,
                                 _type=doc.meta.doc_type)
                  current_search_client.indices.flush(
                      index=','.join(affected_indices), wait_if_ongoing=True)
          bulk(self.client, _delete_actions(), refresh=True)
docs: Delete aggregation documents.