根据文档,我使用一些模型字段创建了类,以便稍后进行搜索。另外,我还创建了带有默认参数的连接。但是我无法为UserIndex
from elasticsearch_dsl import DocType, Text, Boolean, Date, Keyword
from elasticsearch_dsl.connections import connections
connections.create_connection(hosts=['localhost'], timeout=20)
class UserIndex(DocType):
pk = Text()
phone_number = Text()
nickname = Text()
name = Text()
birth_date = Date()
class Meta:
index = 'user'
在UserIndex.init()
命令之后,出现错误:
File ".../lib/python3.6/site-packages/elasticsearch_dsl/document.py", line 138, in init
i.save(using=using)
File ".../lib/python3.6/site-packages/elasticsearch_dsl/index.py", line 289, in save
current_settings = self.get_settings(using=using)[self._name]['settings']['index']
KeyError: '*'
答案 0 :(得分:1)
您使用的是哪个版本的elasticsearch-dsl?最新版本(6.3.0)似乎有问题(This posted issue seems similar)。
回滚到6.2.1为我解决了此错误。