[英]Searching through multiple index yielding 0 documents in elasticsearch-py
I have a search query to make across multiple indexes. 我有一个搜索查询,可以跨多个索引。 To enable this as per the documentation , I need to provide a comma-separated list of indexes.
要根据文档启用此功能,我需要提供一个逗号分隔的索引列表。
But when I try to do it as:
es.search(index='index1,index2',body=body)
但是当我尝试这样做时:
es.search(index='index1,index2',body=body)
I get no result: {u'hits': {u'hits': [], u'total': 0, u'max_score': None}, u'_shards': {u'successful': 10, u'failed': 0, u'skipped': 0, u'total': 10}, u'took': 1, u'timed_out': False}
我没有结果:
{u'hits': {u'hits': [], u'total': 0, u'max_score': None}, u'_shards': {u'successful': 10, u'failed': 0, u'skipped': 0, u'total': 10}, u'took': 1, u'timed_out': False}
However, index='_all' works to search across all index. 但是,index ='_ all'可以搜索所有索引。 Am I doing something incorrectly here or is there some issue with this functionality?
我在这里做错什么了吗,或者此功能有问题? Thanks.
谢谢。
According to the documentation posted by you: 根据您发布的文档:
In your code you pass a string: 在您的代码中,您传递了一个字符串:
es.search(index='index1,index2',body=body)
So you should simply: 因此,您应该简单地:
es.search(index=['index1','index2'],body=body)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.