# Using date\_range with no upper bound with date\_histogram fails

**URL:** https://discuss.elastic.co/t/using-date-range-with-no-upper-bound-with-date-histogram-fails/224001
**Category:** Elasticsearch
**Created:** [March 17, 2020, 8:53pm UTC](https://discuss.elastic.co/t/using-date-range-with-no-upper-bound-with-date-histogram-fails/224001 "2020-03-17T20:53:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ajacob](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ajacob](https://discuss.elastic.co/u/ajacob)
#### Post date: [March 17, 2020, 8:53pm UTC](https://discuss.elastic.co/t/using-date-range-with-no-upper-bound-with-date-histogram-fails/224001/1 "2020-03-17T20:53:30Z")

</div>

I'm trying to use date\_range data type with date\_histogram aggregation and have difficulties when I don't have upper bound.

Index mapping:

```auto
{
	"mappings": {
		"properties": {
			"dateRange": { "type": "date_range" }
		}
	}
}

```

Document:

```auto
{
	"dateRange": {
		"gte": "2020-03-01"
	}
}

```

Query:

```auto
{
	"aggs": {
		"test": {
			"date_histogram": {
				"field": "activationRange",
				"interval" : "day"
			}
		}
	}
}

```

Error:

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "circuit_breaking_exception",
        "reason": "[request] Data too large, data for [<reused_arrays>] would be [805344256/768mb], which is larger than the limit of [622775500/593.9mb]",
        "bytes_wanted": 805344256,
        "bytes_limit": 622775500,
        "durability": "TRANSIENT"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "test",
        "node": "4xCqglNLTvSS2a_Zr83YaQ",
        "reason": {
          "type": "circuit_breaking_exception",
          "reason": "[request] Data too large, data for [<reused_arrays>] would be [805344256/768mb], which is larger than the limit of [622775500/593.9mb]",
          "bytes_wanted": 805344256,
          "bytes_limit": 622775500,
          "durability": "TRANSIENT"
        }
      }
    ]
  },
  "status": 429
}

```

This error makes sense and I understand that ES tries to generate buckets for every day from 2020-03-01 to infinite.  
But now I wonder if there is a way to tell ES to stop creating buckets after a certain date.  
For example, it would be great to give a limit date like "now" or an explicit date like "2020-03-18".

May be this feature exists somehow or there is a workaround ?

Thank you for your attention

---

<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: [March 18, 2020, 3:12pm UTC](https://discuss.elastic.co/t/using-date-range-with-no-upper-bound-with-date-histogram-fails/224001/2 "2020-03-18T15:12:48Z")

</div>

Hey,

thanks for reporting! I opened a github issue for this one, to make sure it does not get lost, I think this justifies some better behaviour. See [https://github.com/elastic/elasticsearch/issues/53736](https://github.com/elastic/elasticsearch/issues/53736)

--Alex

---

<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: [April 15, 2020, 3:12pm UTC](https://discuss.elastic.co/t/using-date-range-with-no-upper-bound-with-date-histogram-fails/224001/3 "2020-04-15T15:12:55Z")

</div>

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