# Fixed interval in date histogram error

**URL:** https://discuss.elastic.co/t/fixed-interval-in-date-histogram-error/308071
**Category:** Elasticsearch
**Created:** [June 24, 2022, 3:21am UTC](https://discuss.elastic.co/t/fixed-interval-in-date-histogram-error/308071 "2022-06-24T03:21:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![yeylatte](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yeylatte/32/107528_2.png) [@yeylatte](https://discuss.elastic.co/u/yeylatte)
#### Post date: [June 24, 2022, 3:21am UTC](https://discuss.elastic.co/t/fixed-interval-in-date-histogram-error/308071/1 "2022-06-24T03:21:51Z")

</div>

Elasticsearch Version

7.17.4

Java Version

1.8.0

OS Version

Linux

Problem Description

I use date\_histogram aggregation from Elasticsearch with fixed\_interval of 7d in time range from 2022-06-18 to 2022-07-01(14days). my expected result is two buckets with two 7days interval start from 06-18. but actually i got 3 buckets, and first from 06-16 even not in my range query.  
sorry if this is not a bug, and what can i do to get right result.

Steps to Reproduce

{  
"query": {  
"range": {  
"date": {  
"from": "2022-06-18",  
"to": "2022-07-01"  
}  
}  
},  
"size": 0,  
"aggs": {  
"data\_analysis": {  
"date\_histogram": {  
"field": "date",  
"fixed\_interval": "7d",  
"min\_doc\_count": 1  
}  
}  
}  
}

---

<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 22, 2022, 3:22am UTC](https://discuss.elastic.co/t/fixed-interval-in-date-histogram-error/308071/2 "2022-07-22T03:22:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
