コード例 #1
0
    def handle(self, *args, **options):
        host = settings.HAYSTACK_CONNECTIONS['default']['URL']
        alias = settings.HAYSTACK_CONNECTIONS['default']['INDEX_NAME']

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

        ElasticsearchUtils.create_alias_and_index(es, alias)
コード例 #2
0
ファイル: mixins.py プロジェクト: edx/course-discovery
 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)