[英]Searching through multiple index yielding 0 documents in elasticsearch-py
我有一個搜索查詢,可以跨多個索引。 要根據文檔啟用此功能,我需要提供一個逗號分隔的索引列表。
但是當我嘗試這樣做時:
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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.