我正在用 elasticsearch 構建一個問答網路應用程式。我剛剛成功安裝了farm-haystack==1.3.0 和帶有requirements.txt 的farm。
現在當我匯入庫時,它會彈出一個錯誤:
from haystack.document_store.elasticsearch import ElasticsearchDocumentStore
# from haystack.document_stores.elasticsearch import ElasticsearchDocumentStore
document_store = ElasticsearchDocumentStore(host="localhost", username="", password="", index="document")
錯誤:
ModuleNotFoundError: No module named 'haystack.document_store.elasticsearch'; 'haystack.document_store' is not a package
如果有人能告訴我如何解決它,那就太好了。我已經確定我的 haystack.document_store.elasticsearch 不是 document_store 的。
uj5u.com熱心網友回復:
根據 haystack 檔案https://haystack.deepset.ai/overview/migration,從 1.0 版本開始,可以直接從 haystack.document_stores 訪問 ElasticsearchDocumentStore。
from haystack.document_stores import ElasticsearchDocumentStore
另請注意,對于 1.0 之后的版本,document_store's' 的復數也是必需的。也就是說,“document_store s ”末尾需要“ s ”。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/463953.html
上一篇:為什么Elasticsearch在默認設定下使用9GB記憶體?
下一篇:運行filebeat設定失敗
