# Discover: failed to parse date field

**URL:** <https://discuss.elastic.co/t/discover-failed-to-parse-date-field/100932>\
**Category:** Kibana\
**Created:** [September 18, 2017, 8:47pm UTC](https://discuss.elastic.co/t/discover-failed-to-parse-date-field/100932 "2017-09-18T20:47:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [September 18, 2017, 11:11pm UTC](https://discuss.elastic.co/t/discover-failed-to-parse-date-field/100932/2 "2017-09-18T23:11:41Z")

</div>

I create a mapping like this;

```auto
PUT test6
{
   "mappings": {
     "test": {
       "properties": {
        "time" : {
           "type" : "date",
           "format" : "yyyy'M'MM"
        }
       }
     }
   }
 }

```

And created a few docs like this one;

```auto
POST test6/test
{
  "time":"2017M06",
  "value":"jun17"
}

```

I can seem them in Discover;

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/6/b67a28810c37d10b16d9af254069637c4ef080fc.png)

And I was able to add a filter in Discover using the same date format used to post the docs;

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/a/4ad425d042a9add12418b16b51c5e8e70483903d.png)

And if I edit the DSL Query, I see the same format;

```auto
{
  "range": {
    "time": {
      "gte": "2017M07",
      "lt": "2017M09"
    }
  }
}

```

And I can also put this in the query bar `time:["2017M08" TO "2017M09"]`

So far, so good. But if I click on the + by a time value to add a filter I get this;

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/6/56e3518fb2cdf3a0c2cc2e232fcc27049eb66e3b.png)

And the query for that is;

```auto
{
  "query": {
    "match": {
      "time": {
        "query": 1501545600000,
        "type": "phrase"
      }
    }
  }
}

```

So I thought I would set the format for this `time` field in the index pattern to "YYYY'M'MM" so that it would show correctly in Discover, and might also fix this issue. But it's not treating the single-quoted 'M' as a string. I'll file a bug on that.

> <https://github.com/elastic/kibana/issues/14049>

---

_[View the full topic](https://discuss.elastic.co/t/discover-failed-to-parse-date-field/100932)._
