# Breaking change v6 to v7 to search date\_time\_parse\_exception 'hh:mm:ss a'

**URL:** <https://discuss.elastic.co/t/breaking-change-v6-to-v7-to-search-date-time-parse-exception-hhss-a/217444>\
**Category:** Elasticsearch\
**Created:** [January 31, 2020, 6:07pm UTC](https://discuss.elastic.co/t/breaking-change-v6-to-v7-to-search-date-time-parse-exception-hhss-a/217444 "2020-01-31T18:07:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![akatz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akatz/32/46821_2.png) [@akatz](https://discuss.elastic.co/u/akatz)\
**Post date:** [January 31, 2020, 6:07pm UTC](https://discuss.elastic.co/t/breaking-change-v6-to-v7-to-search-date-time-parse-exception-hhss-a/217444/1 "2020-01-31T18:07:16Z")

</div>

I have tested that the following query works in versions of ES 6 (6.2.3, 6.8.2), but fails in versions of 7 (7.1.1, 7.3.1).

The query is:

```
{
  "query": {
    "bool": {
      "filter": [
        {
          "range": {
            "runServiceTimeUTC": {
              "gte": "12:50:00 PM",
              "lte": "01:10:00 PM",
              "format": "hh:mm:ss a"
            }
          }
        }
      ]
    }
  }
}

```

The field is formatted as a date with format 'hh:mm:ss a':

```
"runServiceTimeUTC" : {
  "type" : "date",
  "format" : "hh:mm:ss a"
}

```

The resulting error in v7 (7.1.1, 7.3.1) is as follows:

```
{
  "error": {
    "root_cause": [
      {
        "type": "parse_exception",
        "reason": "failed to parse date field [01:10:00 PM] with format [hh:mm:ss a]: [Text '01:10:00 PM' could not be parsed: Conflict found: HourOfDay 23 differs from HourOfDay 13 while resolving AmPmOfDay]"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "rundirections_43800dac-9f95-40f2-9414-3dc58ac3234a_1579189356676",
        "node": "jI6lf6EFSimbcIRTzk2MAQ",
        "reason": {
          "type": "parse_exception",
          "reason": "failed to parse date field [01:10:00 PM] with format [hh:mm:ss a]: [Text '01:10:00 PM' could not be parsed: Conflict found: HourOfDay 23 differs from HourOfDay 13 while resolving AmPmOfDay]",
          "caused_by": {
            "type": "date_time_parse_exception",
            "reason": "Text '01:10:00 PM' could not be parsed: Conflict found: HourOfDay 23 differs from HourOfDay 13 while resolving AmPmOfDay",
            "caused_by": {
              "type": "date_time_exception",
              "reason": "Conflict found: HourOfDay 23 differs from HourOfDay 13 while resolving AmPmOfDay"
            }
          }
        }
      }
    ]
  },
  "status": 400
}

```

If I change the range query to read as follows, the query suddenly works:

```
{
  "range": {
    "runServiceTimeUTC": {
      "gte": "12:50:00 PM",
      "lte": "13:10:00 PM",
      "format": "HH:mm:ss a"
    }
  }
}

```

Any ideas what's going wrong here?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 3, 2020, 3:48pm UTC](https://discuss.elastic.co/t/breaking-change-v6-to-v7-to-search-date-time-parse-exception-hhss-a/217444/2 "2020-02-03T15:48:17Z")

</div>

Hey,

european time person here (so I may be fully off), but isn't it the case, that PM dates only range up to `12` and there is no such thing like 13:10:00 PM (but rather `01:10:00 PM`, this this is not a valid date and parsing fails.

--Alex

---

<div class="post-metadata">

**Author:** ![akatz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akatz/32/46821_2.png) [@akatz](https://discuss.elastic.co/u/akatz)\
**Post date:** [February 3, 2020, 7:11pm UTC](https://discuss.elastic.co/t/breaking-change-v6-to-v7-to-search-date-time-parse-exception-hhss-a/217444/3 "2020-02-03T19:11:14Z")

</div>

Hi Alex,

You're absolutely correct, which is why I am confused as to why the last query (13:10:00 PM) actually works correctly when formatted as 'HH:mm:ss a,' but the first query (01:10:00 PM) does NOT work when formatted as 'hh:mm:ss a.'

The exception reason would indicate that the parser does recognize the hour of day as 13 from the 01 and the PM, but the 'HourOfDay 23' doesn't really make much sense to me...

---

<div class="post-metadata">

**Author:** ![akatz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akatz/32/46821_2.png) [@akatz](https://discuss.elastic.co/u/akatz)\
**Post date:** [February 27, 2020, 3:12pm UTC](https://discuss.elastic.co/t/breaking-change-v6-to-v7-to-search-date-time-parse-exception-hhss-a/217444/4 "2020-02-27T15:12:24Z")

</div>

Have you been able to recreate this issue?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 12, 2020, 10:25am UTC](https://discuss.elastic.co/t/breaking-change-v6-to-v7-to-search-date-time-parse-exception-hhss-a/217444/5 "2020-03-12T10:25:19Z")

</div>

Yes, I think some leniency has been removed here in order to specify invalid dates.

---

<div class="post-metadata">

**Author:** ![akatz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akatz/32/46821_2.png) [@akatz](https://discuss.elastic.co/u/akatz)\
**Post date:** [March 12, 2020, 7:04pm UTC](https://discuss.elastic.co/t/breaking-change-v6-to-v7-to-search-date-time-parse-exception-hhss-a/217444/6 "2020-03-12T19:04:20Z")

</div>

But the following is not an invalid date (as far as I can tell):

> "gte": "12:50:00 PM",  
> "lte": "01:10:00 PM",  
> "format": "hh:mm:ss a"

And yet, it fails.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 13, 2020, 4:24pm UTC](https://discuss.elastic.co/t/breaking-change-v6-to-v7-to-search-date-time-parse-exception-hhss-a/217444/7 "2020-03-13T16:24:22Z")

</div>

yes, as it was working before, please open an issue with two reproducible examples (old and new), so the developers can take a look.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 10, 2020, 4:24pm UTC](https://discuss.elastic.co/t/breaking-change-v6-to-v7-to-search-date-time-parse-exception-hhss-a/217444/8 "2020-04-10T16:24:30Z")

</div>

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