# Range on timestamp ruins my query

**URL:** <https://discuss.elastic.co/t/range-on-timestamp-ruins-my-query/143101>\
**Category:** Kibana\
**Created:** [August 6, 2018, 7:07am UTC](https://discuss.elastic.co/t/range-on-timestamp-ruins-my-query/143101 "2018-08-06T07:07:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JPelastic](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@JPelastic](https://discuss.elastic.co/u/JPelastic)\
**Post date:** [August 6, 2018, 7:07am UTC](https://discuss.elastic.co/t/range-on-timestamp-ruins-my-query/143101/1 "2018-08-06T07:07:07Z")

</div>

Hi

I'm trying to set up a date histogram. When I look into the request it forms, I get this:

> {  
> "aggs": {  
> "2": {  
> "date\_histogram": {  
> "field": "aanvaard of a-posteriori op",  
> "interval": "1y",  
> "time\_zone": "Europe/Berlin",  
> "min\_doc\_count": 1  
> }  
> }  
> },  
> "size": 0,  
> "\_source": {  
> "excludes":   
> },  
> "stored\_fields": [  
> "\*"  
> ],  
> "script\_fields": {},  
> "docvalue\_fields": [  
> "@timestamp",  
> "aanvaard of a-posteriori op",  
> "certificate.COForm.COFormContent.Signatory.SignatureDate"  
> ],  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "range": {  
> "@timestamp": {  
> "gte": 1533538243247,  
> "lte": 1533539143247,  
> "format": "epoch\_millis"  
> }  
> }  
> }  
> ],  
> "filter": [  
> {  
> "match\_all": {}  
> }  
> ],  
> "should": ,  
> "must\_not":   
> }  
> }  
> }

But I should not have the must/range in there - how can I get rid of it?  
I just want to take all my docs and put them into the buckets. Timestamp is the date I added the docs - which was last friday.

---

<div class="post-metadata">

**Author:** ![christophilus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christophilus/32/42991_2.png) [@christophilus](https://discuss.elastic.co/u/christophilus)\
**Post date:** [August 6, 2018, 1:16pm UTC](https://discuss.elastic.co/t/range-on-timestamp-ruins-my-query/143101/2 "2018-08-06T13:16:38Z")

</div>

Hi Johan.

To the best of my knowledge, date histograms in Kibana always operate on a time range. You can configure the time range to be a custom value (e.g. by clicking on the "Last 5 years" link illustrated below, or the equivalent in your visualization) thus effectively encompassing all documents. But the idea is that it's generally a good idea to limit what you're reporting on to some definite time range.

![image](https://us1.discourse-cdn.com/elastic/original/3X/d/c/dc4b55f0449c3238537c30eef9dc163f49d091c4.png)

Best,  
Chris

---

<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:** [September 3, 2018, 1:16pm UTC](https://discuss.elastic.co/t/range-on-timestamp-ruins-my-query/143101/3 "2018-09-03T13:16:49Z")

</div>

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