def handle(self, *args, **options):
        host = settings.ELASTICSEARCH['host']
        alias = settings.ELASTICSEARCH['index']

        logger.info('Attempting to establish initial connection to Elasticsearch host [%s]...', host)
        es = Elasticsearch(host, sniff_on_start=True)
        logger.info('...success!')

        ElasticsearchUtils.create_alias_and_index(es, alias)
예제 #2
0
 def reset_index(self):
     """ Deletes and re-creates the Elasticsearch index. """
     self.delete_index(self.index)
     ElasticsearchUtils.create_alias_and_index(self.es, self.index)