Date range query with travel-sample date format

Hi, I am trying to build an index for the hotel docs in travel-sample dataset, specifically for the field:
reviews.date

The date format appears to be “YYYY-MM-DD hh-mm-ss zzz” yet I cannot get a result with the date range below.
I thought at first it just wasn’t indexing, but when I update the field to include only the date portion (substr(date,0,10)) it works fine even with a default index and the following query.

Can anyone confirm the same behaviour? Is it an issue with date parser?

Thanks!

{
  "explain": false,
  "fields": [
    "*"
  ],
  "highlight": {},
  "query": { 
    "start": "2010-10-12",
    "end": "2021-10-09",
    "inclusive_start": true,
    "inclusive_end": true
  }
}

For anyone else hitting datetime parsing issues in the hotel records of travel-sample, you can run this query to grab just the date (not time or timezone) portion there:
UPDATE travel-sample AS ts
SET r.date = SUBSTR(r.date,0,10) FOR r IN ts.reviews END

Hello @tylermitchell,

The problem here is with the datetime parser used. By default FTS expects dates to be in the format specified by RFC-3339, which is a specific profile of ISO-8601.

If you specify a custom datetime analyser with a custom layout like below which fits the actual format in the reviews.date field (“2014-04-11 09:10:19 +0300”), it should work.

"mapping": {
      "analysis": {
        "date_time_parsers": {
          "customDate": {
            "layouts": [
              "2006-01-02 15:04:05 +0300"
            ],
            "type": "flexiblego"
          }
        }
      },

Attaching a screen shot too.

Cheers!
Sreekanth