# Using yyyyMMdd dates

**URL:** <https://discuss.elastic.co/t/using-yyyymmdd-dates/12886>\
**Category:** Elasticsearch\
**Created:** [July 22, 2013, 7:31pm UTC](https://discuss.elastic.co/t/using-yyyymmdd-dates/12886 "2013-07-22T19:31:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Douglas\_Moore](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@Douglas\_Moore](https://discuss.elastic.co/u/Douglas_Moore)\
**Post date:** [July 22, 2013, 7:31pm UTC](https://discuss.elastic.co/t/using-yyyymmdd-dates/12886/1 "2013-07-22T19:31:49Z")

</div>

I have a number of fields in the yyyyMMdd format, and I've tried to setup a  
a number of date formats in my mapping to get those fields to be understood  
well by the date\_histogram in Kibana 3, and date type queries. Nothing  
seems to work properly.

Will this work much better with with the data formatted as yyyy-MM-dd, and  
to use the "type":"date" mapping ?

Thanks,  
Douglas

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 23, 2013, 6:23am UTC](https://discuss.elastic.co/t/using-yyyymmdd-dates/12886/2 "2013-07-23T06:23:44Z")

</div>

Hey,

can you show us a gist what you did, so we can take a look, where the  
problem might be?

I guess you are running into

> <https://github.com/elastic/elasticsearch/issues/2937>
>
> if given some document date field that is a basic date, such as
> {
> "doc\_field" : …"20130425"
> }
> and \_timestamp uses it as its path, it defaults to parsing the integer as ms rather than as the format
> \_timestamp{
> "format":"yyyyMMdd",
> "enabled":true
> }

--Alex

On Mon, Jul 22, 2013 at 9:31 PM, Douglas Moore [dmoore247@gmail.com](mailto:dmoore247@gmail.com) wrote:

> I have a number of fields in the yyyyMMdd format, and I've tried to setup  
> a a number of date formats in my mapping to get those fields to be  
> understood well by the date\_histogram in Kibana 3, and date type queries.  
> Nothing seems to work properly.
> 
> Will this work much better with with the data formatted as yyyy-MM-dd, and  
> to use the "type":"date" mapping ?
> 
> Thanks,  
> Douglas
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Douglas\_Moore](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@Douglas\_Moore](https://discuss.elastic.co/u/Douglas_Moore)\
**Post date:** [July 23, 2013, 5:05pm UTC](https://discuss.elastic.co/t/using-yyyymmdd-dates/12886/3 "2013-07-23T17:05:50Z")

</div>

Alex,  
Quite possibly the same error as during my query tests on the field it  
responded as an integer.

When the data is formatted as yyyy-MM-dd the date\_histogram & Kibana 3 did  
work better. Date filtering such as dob \< 1900 worked well too.  
I had to change the format from "type":"date", "format:"basicDate" to  
simple "type":"date"

Re: Gist: I don't have a good isolated test.

Is there a work around to issue 2937 ? I'm on 0.90.0 release.

Thanks,  
Douglas

On Tuesday, July 23, 2013 2:23:44 AM UTC-4, Alexander Reelsen wrote:

> Hey,
> 
> can you show us a gist what you did, so we can take a look, where the  
> problem might be?
> 
> I guess you are running into  
> [Timestamp defaults to parsing int even if given a format · Issue #2937 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/2937)
> 
> --Alex
> 
> On Mon, Jul 22, 2013 at 9:31 PM, Douglas Moore \<[dmoo...@gmail.com](mailto:dmoo...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I have a number of fields in the yyyyMMdd format, and I've tried to setup  
> > a a number of date formats in my mapping to get those fields to be  
> > understood well by the date\_histogram in Kibana 3, and date type queries.  
> > Nothing seems to work properly.
> > 
> > Will this work much better with with the data formatted as yyyy-MM-dd,  
> > and to use the "type":"date" mapping ?
> > 
> > Thanks,  
> > Douglas
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 2:24am UTC](https://discuss.elastic.co/t/using-yyyymmdd-dates/12886/4 "2017-07-06T02:24:57Z")

</div>


