Kibana v 7.9.2 小时_分钟_秒的精确格式

2024-01-01

我跟着

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. enter image description here


预期的格式hour_minute_second_fraction is HH:mm:ss.SSS,所以在你的情况下,这意味着12:50:30.400

如果你想继续使用12_50_30_40,那么你需要设置自己的格式,如下所示:

"runtime": {
  "type": "date",
  "format": "HH_mm_ss_SS"
},
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Kibana v 7.9.2 小时_分钟_秒的精确格式 的相关文章

随机推荐