paramikoooo
paramikoooo

Reputation: 178

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"

Upvotes: 0

Views: 164

Answers (1)

Bhavya
Bhavya

Reputation: 16192

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"
      }
    }
  }
}

Upvotes: 1

Related Questions