简体   繁体   中英

Parse ElasticSearch time format

I want to know what is the time format of 2021-02-11T14:05:22.123123 to put in query like

query = 
'{
 
  "sort": [
    {
      "date": {
        "order": "desc"
      }
    }
  ],
"query": {
    "bool": {
      "must": [
        {
          "range": {
            "date": {
              "gte": "2021-02-11T14:05:22.123123",
              "format": "WHAT ???????"
            }
          }
        }
      ]
    }
  }
}'

What should I need to write into "format"

You need to use this below format of date , in order to parse 2021-02-11T14:05:22.123123

{
  "mappings": {
    "properties": {
      "date": {
        "type": "date",
        "format": "yyyy-MM-dd'T'HH:mm:ss.SSSSSS"
      }
    }
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM