Date math and rounding is not work when the format is not specified

We use ES 2.4.1.
When the date datatype field does not specify the 'format', we use the rounded date and specify the format in the query, the query result is incorrect.

mapping:
{
    "rd": {
              "type": "date",
              "format": "strict_date_optional_time||epoch_millis"
           },
}

query:
{
    "range" : {
      "rd" : {
        "from" : "2012-11-11||/M",
        "to" : "2013-01-11||/M",
        "format" : "yyyy-MM-dd",
        "include_lower" : true,
        "include_upper" : true
      }
    }
}

result:
{
  "hits": {
      "total": 0,
      "max_score": null,
      "hits": []
   }
}

When the 'format' is specified, the query result is correct.

{
    "rd": {
              "type": "date",
              "format": "yyyyMMdd||strict_date_optional_time||epoch_millis"
           },
}

Any help is appreciated!

Hey,

I'm sorry, but that Elasticsearch version has not been supported for quite some years, and we will not provide any bugfixes for that version. Please use a recent version (like 7.0) and provide an example that can be fully reproduced by copy/pasting, so we can see if your issue still exists.

Thanks!

--Alex

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