Es问题--索引mapping日期类型

五迷三道 提交于 2020-08-14 20:26:38

在 JSON 文档中,日期表示为字符串.Elasticsearch 使用一组预先配置的格式来识别和解析这些字符串表示为 milliseconds-since-the-epoch in UTC.

除了内置格式,你可以使用熟悉的 yyyy/MM/dd 语法指定自己的自定义格式.

curl -XPUT 'localhost:9200/my_index?pretty' -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "my_type": {
      "properties": {
        "date": {
          "type":   "date",
          "format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        }
      }
    }
  }
}

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!