2017-08-29 118 views
0

我正在使用elasticsearch的Python客戶端和elasticsearch-dsl以及。我創建了索引IndexName,並驗證了索引的存在。我有一個doc_type DocumentModelIndex與此IndexName相關聯。elasticsearch(Python/Django)批量索引拋出否索引錯誤

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

我試圖把文件成指數使用: 捲曲-XPOST 「http://localhost:9200/index_name/document_model_index/」 -d 「{\」 源\ 「:\」 谷歌\ 「}」 和這個工作。

我是elasticsearch的新手,我無法弄清楚這一點。任何幫助將非常感激!

回答

0

想通了:

DocumentModelIndex DOCTYPE定義: class Meta: index = IndexName