from datetime import datetime
from elasticsearch_dsl import DocType, Date, Nested, Boolean, \
analyzer, InnerObjectWrapper, Completion, Keyword, Text, Integer
from elasticsearch_dsl.connections import connections
connections.create_connection(hosts=["localhost"])
class ArticleType(DocType):
#伯乐在线文章类型
title = Text(analyzer="ik_max_word")
create_date = Date()
praise_nums = Integer()
fav_nums = Integer()
comment_nums = Integer()
front_image_url = Keyword()
front_image_path = Keyword()
url = Keyword()
url_object_id = Keyword()
tags = Text(analyzer="ik_max_word")
content = Text(analyzer="ik_max_word")
class Meta:
index = "jobbole"
doc_type = "article"
if __name__ == "__main__":
ArticleType.init()
这段代码运行的时候,出现了ReadTimeoutError,该怎么解决。

带你彻底掌握Scrapy,用Django+Elasticsearch搭建搜索引擎
了解课程