'Clears the backend of all documents/objects for a collection of models.
:param models: List or tuple of models to clear.
:param commit: Not used.'

def clear(self, models=None, commit=True):

    if (models is not None):
        assert isinstance(models, (list, tuple))
    try:
        if (models is None):
            self.conn.indices.delete(index=self.index_name, ignore=404)
            self.setup_complete = False
            self.existing_mapping = {}
            self.content_field_name = None
        else:
            models_to_delete = []
            for model in models:
                models_to_delete.append((u'%s:%s' % (DJANGO_CT, get_model_ct(model))))
            query = {u'query': {u'query_string': {u'query': u'    OR    '.join(models_to_delete)}}}
            generator = scan(self.conn, query=query, index=self.index_name, doc_type=u'modelresult')
            actions = ({u'_op_type': u'delete', u'_id': doc[u'_id']} for doc in generator)
            bulk(self.conn, actions=actions, index=self.index_name, doc_type=u'modelresult')
            self.conn.indices.refresh(index=self.index_name)
    except elasticsearch.TransportError as e:
        if (not self.silently_fail):
            raise
        if (models is not None):
            self.log.error(u"Failed    to    clear    Elasticsearch    index    of    models    '%s':    %s", u','.join(models_to_delete), e, exc_info=True)
        else:
            self.log.error(u'Failed    to    clear    Elasticsearch    index:    %s', e, exc_info=True)
