Discover: failed to parse date field

I create a mapping like this;

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

And created a few docs like this one;

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

I can seem them in Discover;

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

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

{
  "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;

And the query for that is;

{
  "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.

1 Like