test_elasticsearch_backend.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:django-haystack-elasticsearch 作者: CraveFood 项目源码 文件源码
def test_recreate_index(self):
        clear_elasticsearch_index()

        sb = connections['default'].get_backend()
        sb.silently_fail = True
        sb.setup()

        original_mapping = self.raw_es.indices.get_mapping(index=sb.index_name)

        sb.clear()
        sb.setup()

        try:
            updated_mapping = self.raw_es.indices.get_mapping(sb.index_name)
        except elasticsearch.NotFoundError:
            self.fail("There is no mapping after recreating the index")

        self.assertEqual(original_mapping, updated_mapping,
                         "Mapping after recreating the index differs from the original one")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号