# Date histogram aggregation on an open date range field

**URL:** https://discuss.elastic.co/t/date-histogram-aggregation-on-an-open-date-range-field/225060
**Category:** Elasticsearch
**Created:** [March 25, 2020, 8:07pm UTC](https://discuss.elastic.co/t/date-histogram-aggregation-on-an-open-date-range-field/225060 "2020-03-25T20:07:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![krlm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krlm/32/46106_2.png) [@krlm](https://discuss.elastic.co/u/krlm)
#### Post date: [March 25, 2020, 8:07pm UTC](https://discuss.elastic.co/t/date-histogram-aggregation-on-an-open-date-range-field/225060/1 "2020-03-25T20:07:52Z")

</div>

Hi I'm trying to execute an `date_histogram` aggregation on a index with `date_range` field where some of documents can have _open end_ (no value for `lt` or `lte` of that `date_rage`).  
here's my setup:  
index:

```auto
PUT /events
{
  "mappings": {
    "dynamic": "false",
    "properties": { 
      "dateRange": {
        "type": "date_range"
      }
    }
  }
}

```

doc:

```auto
PUT /events/_doc/1
{
  "dateRange": {
    "gte": "2020-02-20"
  },
}

```

query:

```auto
POST /events/_search?pretty=true&error_trace=true
{
  "aggs": {
    "events-histogram": {
      "date_histogram": {
        "field": "dateRange",
        "calendar_interval": "day"
      }
    }
  },
  "size": 0
}

```

unfortunately even if there's only one such document above query results in following exception:

```auto
CircuitBreakingException[[request] Data too large, data for [<reused_arrays>] would be [805344256/768mb], which is larger than the limit of [633785548/604.4mb]]

```

I've tried to use scripts to workaround that but `doc['dateRange'].value` returns some obscure (i.e. `"\u0001©p_䠀?\uDFBF\uDFFF\uDFBF\uDFC0"` ) `java.lang.String` value and I'm a bit confused. Also, `missing` option which can be used with regular `date` fields doesn't work here. I'm rookie ES user, so I might be missing something.

---

<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 22, 2020, 8:07pm UTC](https://discuss.elastic.co/t/date-histogram-aggregation-on-an-open-date-range-field/225060/2 "2020-04-22T20:07:59Z")

</div>

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