elasticsearch_dsl.exceptions.ValidationException: You cannot write to a wildcard index.

elasticsearch_dsl.exceptions.ValidationException: You cannot write to a wildcard index.

python,将elasticsearch-dsl升级到6.2.1版本时候,报错:

elasticsearch_dsl.exceptions.ValidationException: You cannot write to a wildcard index.

解决办法:
之前是只有

class IndexType(DocType):
    class Meta:
        doc_type = 'doc_type_name'
        index = 'index_name'

需要加上

class IndexType(DocType):
    class Meta:
        doc_type = 'doc_type_name'
        index = 'index_name'

    class Index:
        doc_type = 'doc_type_name'
        index = 'index_name'

参考
https://github.com/elastic/elasticsearch-dsl-py/issues/953
https://github.com/elastic/elasticsearch-dsl-py/issues/933
https://github.com/elastic/elasticsearch-dsl-py/issues/941

cause = ‘, %r’ % self.info[‘error’][‘root_cause’][0][‘reason’]

我遇到此问题,原因是,使用的elasticsearch的版本比较高,而elasticsearch-dsl却是一个很低的版本,将elasticsearch-dsl升级,即可。

猜你喜欢

转载自blog.csdn.net/yangyangrenren/article/details/81196221