本文整理汇总了Python中elasticsearch_dsl.Index.search方法的典型用法代码示例。如果您正苦于以下问题:Python Index.search方法的具体用法?Python Index.search怎么用?Python Index.search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elasticsearch_dsl.Index
的用法示例。
在下文中一共展示了Index.search方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_registered_doc_type_included_in_search
# 需要导入模块: from elasticsearch_dsl import Index [as 别名]
# 或者: from elasticsearch_dsl.Index import search [as 别名]
def test_registered_doc_type_included_in_search():
i = Index('i', using='alias')
i.doc_type(Post)
s = i.search()
assert s._doc_type_map == {'post': Post}
示例2: test_registered_doc_type_included_in_search
# 需要导入模块: from elasticsearch_dsl import Index [as 别名]
# 或者: from elasticsearch_dsl.Index import search [as 别名]
def test_registered_doc_type_included_in_search():
i = Index('i', using='alias')
i.document(Post)
s = i.search()
assert s._doc_type == [Post]
示例3: test_inner_hits_are_wrapped_in_response
# 需要导入模块: from elasticsearch_dsl import Index [as 别名]
# 或者: from elasticsearch_dsl.Index import search [as 别名]
def test_inner_hits_are_wrapped_in_response(data_client):
i = Index('git')
i.doc_type(Repository)
i.doc_type(Commit)
s = i.search()[0:1].doc_type(Commit).query('has_parent', type='repos', inner_hits={}, query=Q('match_all'))
response = s.execute()
commit = response.hits[0]
assert isinstance(commit.meta.inner_hits.repos, response.__class__)
assert isinstance(commit.meta.inner_hits.repos[0], Repository)
示例4: test_search_is_limited_to_index_name
# 需要导入模块: from elasticsearch_dsl import Index [as 别名]
# 或者: from elasticsearch_dsl.Index import search [as 别名]
def test_search_is_limited_to_index_name():
i = Index('my-index')
s = i.search()
assert s._index == ['my-index']