Date Time Issue with Index

when I apply a date filter, I get this error, my data is correct (when checked from individual index)

Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"parse_exception","reason":"failed to parse date field [11/01/2019] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [11/01/2019] with format [strict_date_optional_time||epoch_millis]]"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"masterdata_sutton","node":"GmJc3-wgQPe3-BzzbdkccQ","reason":{"type":"parse_exception","reason":"failed to parse date field [11/01/2019] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [11/01/2019] with format [strict_date_optional_time||epoch_millis]]","caused_by":{"type":"illegal_argument_exception","reason":"failed to parse date field [11/01/2019] with format [strict_date_optional_time||epoch_millis]","caused_by":{"type":"date_time_parse_exception","reason":"date_time_parse_exception: Failed to parse with all enclosed parsers"}}}}]},"status":400}

I am facing the same problem.
Any advice will be greatly appreciated! thank you!

I have set explicit dates formats in my template now

Today I also found the solution @adwaitjoshi. For my case, I do not use date format in the index mapping, I just use the same format date that the TIMESTAMP field has in the doc. And it's working.

What was your fix? Put it for the rest of the world here please.

Please check the below two solutions that are working for me:
1st way

GET your_index/_search
{
  "query":{
    "range":{
      "your_time_field":{
        "gte": "2019-01-01T00:00:00.000+0200",
        "lte": "2019-06-30T23:59:59.000+0200"
      }
    }
  }
}

Here the format of the field your_time_field "2019-01-01T00:00:00.000+0400" is exactly as it is included in my relevant field of the index.

2nd way

GET your_index/_search
{
  "query":{
    "range":{
      "your_time_field":{
        "gte": "01-01-2019",
        "lte": "30-06-2019",
        "format": "dd-MM-yyyy"
      }
    }
  }
}

Here you can include an extra line "format" and write the time range of "gte" and "lte" according to the time format you prefer (mine is as aforementioned above "format": "dd-MM-yyyy"). This API will return the results with your "your_time_field" format as you have stated regardless of how the time format has been registered in the index.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.