# Date\_histogram aggregation and DST

**URL:** <https://discuss.elastic.co/t/date-histogram-aggregation-and-dst/17918>\
**Category:** Elasticsearch\
**Created:** [June 5, 2014, 8:31am UTC](https://discuss.elastic.co/t/date-histogram-aggregation-and-dst/17918 "2014-06-05T08:31:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dunaeth](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dunaeth](https://discuss.elastic.co/u/dunaeth)\
**Post date:** [June 5, 2014, 8:31am UTC](https://discuss.elastic.co/t/date-histogram-aggregation-and-dst/17918/1 "2014-06-05T08:31:55Z")

</div>

Hi,

I wonder whether it was possible or not to have date histogram aggregation  
be DST aware. From what I understand of the date histogram algorithm, it's  
something like :

date + offset - (date + offset) % interval

Maybe a scripted term aggregation would be a better solution if the date  
datas already have a DST aware offset registered.

For example, let's say we have documents with those kind of date fields :

2014-03-29T00:30:00.000+01:00 (2014-03-28T23:30:00.000Z)  
2014-03-30T00:30:00.000+01:00 (2014-03-29T23:30:00.000Z)  
2014-03-31T00:30:00.000+02:00 (2014-03-30T22:30:00.000Z)  
2014-03-31T01:30:00.000+02:00 (2014-03-30T23:30:00.000Z)

Using string manipulation in scripted term aggregation to retrieve document  
by day would be trivial but less performant than date\_histogram aggregation  
which would probably not be able to aggregate dates taking DST into account.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/38837adf-9d91-4214-977e-98db4894de9d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/38837adf-9d91-4214-977e-98db4894de9d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:24am UTC](https://discuss.elastic.co/t/date-histogram-aggregation-and-dst/17918/2 "2017-07-06T01:24:32Z")

</div>


