我有一个搜索查询来跨多个索引。要根据documentation启用此功能,我需要提供以逗号分隔的索引列表。
但是当我尝试这样做时:es.search(index='index1,index2',body=body)
我没有结果:{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}
但是,index ='_ all'可以搜索所有索引。我在这里做错了什么或者这个功能有问题吗?谢谢。
根据您发布的文件:
在您的代码中传递一个字符串:
es.search(index='index1,index2',body=body)
所以你应该简单地说:
es.search(index=['index1','index2'],body=body)