Using date_range with no upper bound with date_histogram fails

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:

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

Document:

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

Query:

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

Error:

{
  "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

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

--Alex

1 Like

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