我跟着
and https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html但我找不到所需的答案。
我使用创建索引
GET film/_mapping
另外根据中接受的答案Elasticsearch:时间数据类型(HH:mm:ss.SSS)字段 https://stackoverflow.com/questions/46071869/elasticsearch-datatype-for-timehhmmss-sss-field/46071925?noredirect=1#comment113849612_46071925
我如下创建了我的映射。
PUT film/_mapping
{
"properties": {
"filmname": {
"type": "keyword"
},
"runtime": {
"type": "date",
"format": "hour_minute_second_fraction"
},
"genre": {
"type": "text"
},
"releasedate":{
"type": "date",
"format": "yyyy-MM-dd"
},
"budget":{
"type": "double"
}
}
}
我尝试使用以下请求添加文档。
PUT film/_doc/1/
{
"film": "The Terminator",
"runtime": "12_50_30_40",
"genre": "SCIFI war Action",
"releasedate": "1984-11-30",
"budget" : "45.12"
}
But it throws the attached error , actually I want to add this field only in hour_minute_second format.