索引映射
"review_start_datetime" : {
"type" : "date"
},
"review_start_time" : {
"type" : "date"
}
班级
from elasticsearch_dsl import Document, Date
class DocumentX(Document):
review_start_datetime = Date(format='yyyy-MM-dd HH:mm:ss',
default_timezone="UTC")
创建数据
doc = DocumentX.get('DEMO_54ddab6')
doc.review_start_time = datetime.datetime.now()
doc.review_start_datetime = datetime.datetime.now()
doc.save()
在执行 save 方法时,它仅针对review_start_datetime字段而不是review_start_time给出以下错误。
elasticsearch.exceptions.RequestError:RequestError(400,'mapper_parsing_exception',“无法解析ID为'DEMO_54ddab6'的文档中类型[日期]的字段[review_start_datetime]”)