[英]elasticsearch (Python/Django) bulk indexing throws No Index error
我也在使用elasticsearch
的python客戶端和elasticsearch-dsl
。 我創建了一個索引IndexName
並驗證了索引的存在。 我有一個與此IndexName
相關聯的doc_type DocumentModelIndex
。
def bulk_indexing():
from app.models import DocumentModel
DocumentModelIndex.init(index=settings.ES_INDEX)
es = Elasticsearch()
bulk(client=es,actions=(b.indexing()
for b in DocumentModel.objects.all().iterator()))
當我運行上面的代碼時,出現以下錯誤: ValidationException: No index
。
我嘗試使用以下命令將文檔放入該索引中:curl -XPOST“ http:// localhost:9200 / index_name / document_model_index / ” -d“ {\\” source \\“:\\” google \\“}”,並且可以正常工作。
我是elasticsearch
新手, elasticsearch
這個問題。 任何幫助將非常感激!
弄清楚了:
在DocumentModelIndex
DocType定義中: class Meta: index = IndexName
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.