本文整理汇总了Python中elasticsearch_dsl.Index.clone方法的典型用法代码示例。如果您正苦于以下问题:Python Index.clone方法的具体用法?Python Index.clone怎么用?Python Index.clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elasticsearch_dsl.Index
的用法示例。
在下文中一共展示了Index.clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cloned_index_has_copied_settings_and_using
# 需要导入模块: from elasticsearch_dsl import Index [as 别名]
# 或者: from elasticsearch_dsl.Index import clone [as 别名]
def test_cloned_index_has_copied_settings_and_using():
client = object()
i = Index('my-index', using=client)
i.settings(number_of_shards=1)
i2 = i.clone('my-other-index')
assert 'my-other-index' == i2._name
assert client is i2._using
assert i._settings == i2._settings
assert i._settings is not i2._settings
示例2: test_cloned_index_has_analysis_attribute
# 需要导入模块: from elasticsearch_dsl import Index [as 别名]
# 或者: from elasticsearch_dsl.Index import clone [as 别名]
def test_cloned_index_has_analysis_attribute():
"""
Regression test for Issue #582 in which `Index.clone()` was not copying
over the `_analysis` attribute.
"""
client = object()
i = Index('my-index', using=client)
random_analyzer_name = ''.join((choice(string.ascii_letters) for _ in range(100)))
random_analyzer = analyzer(random_analyzer_name, tokenizer="standard", filter="standard")
i.analyzer(random_analyzer)
i2 = i.clone('my-clone-index')
assert i.to_dict()['settings']['analysis'] == i2.to_dict()['settings']['analysis']