elasticsearch-dsl 7.0没有DocType
来源:14-12 scrapy写入数据到elasticsearch中 - 1
lostgod
2019-10-19
按现有elasticsearch-dsl官网描述的信息,继承Document
from datetime import datetime
from elasticsearch_dsl import Document, Date, Nested, Boolean,
analyzer, InnerDoc, Completion, Keyword, Text
from elasticsearch_dsl.connections import connections
connections.create_connection(hosts=[“127.0.0.1”])
class CnnewsType(Document):
news_title = Text()
news_content = Text()
news_img = Keyword()
news_page = Keyword()
news_time = Date()
news_area = Text()
class Meta:
index = "china"
doc_type = "news"
if name == “main”:
tb=CnnewsType()
运行es_type.py后通过elasticsearch-head并未产生索引。不知为何,求老师指点。
elasticsearch和dsl均为7.0.0版本
写回答
1回答
-
bobby
2019-10-22
你按照这样改一下试试
082020-04-06
相似问题