ArticleType.init()报错了
来源:14-12 scrapy写入数据到elasticsearch中 - 1
刹那_0
2019-05-08
ArticleType.init()报错了
elasticsearch.exceptions.RequestError: TransportError(400, 'mapper_parsing_exception', 'analyzer [ik_max_word] not found for field [title]')
我用的elasticsearch_dsl是5.1.0的
写回答
2回答
-
刹那_0
提问者
2019-05-08
应该是我下载的es里没有IK分词器
012019-05-10 -
刹那_0
提问者
2019-05-08
from elasticsearch_dsl import DocType, Date, Nested, Boolean, \ analyzer, Completion, Keyword, Text, Integer from elasticsearch_dsl.analysis import CustomAnalyzer as _CustomAnalyzer from elasticsearch_dsl.connections import connections connections.create_connection(hosts=["localhost"]) class ArticleType(DocType): #伯乐在线文章类型 title = Text(analyzer="ik_max_word") create_date = Date() url = Keyword() url_object_id = Keyword() front_image_url = Keyword() front_image_path = Keyword() praise_nums = Integer() comment_nums = Integer() fav_nums = Integer() tags = Text(analyzer="ik_max_word") content = Text(analyzer="ik_max_word") class Meta: index = "jobbole" doc_type = "article" if __name__ == "__main__": ArticleType.init()
00
相似问题