# Date Histogram Aggregation

**URL:** <https://discuss.elastic.co/t/date-histogram-aggregation/42753>\
**Category:** Elasticsearch\
**Created:** [February 25, 2016, 5:22pm UTC](https://discuss.elastic.co/t/date-histogram-aggregation/42753 "2016-02-25T17:22:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![patou](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@patou](https://discuss.elastic.co/u/patou)\
**Post date:** [February 25, 2016, 5:22pm UTC](https://discuss.elastic.co/t/date-histogram-aggregation/42753/1 "2016-02-25T17:22:12Z")

</div>

my docs :  
"periode": [  
{ "start": "2015-09-07T09:00:00.000Z","end": "2015-09-07T10:15:00.000Z"},  
{ "start": "2015-09-07T11:15:00.000Z","end": "2015-09-07T12:30:00.000Z"},  
]  
"periode": [  
{ "start": "2015-09-07T09:00:00.000Z","end": "2015-09-07T10:15:00.000Z"},  
]

i would like a kind of Date Histogram Aggregation to count documents by interval but with a condition : start before the interval or end after the interval.  
in this sample, in interval 09:15-09h30 (interval = 15 m) i have 3 docs

---

<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 5, 2017, 11:13pm UTC](https://discuss.elastic.co/t/date-histogram-aggregation/42753/2 "2017-07-05T23:13:39Z")

</div>


