# Date\_histogram\_aggs interval always 0

**URL:** <https://discuss.elastic.co/t/date-histogram-aggs-interval-always-0/111472>\
**Category:** Elasticsearch\
**Created:** [December 13, 2017, 2:02am UTC](https://discuss.elastic.co/t/date-histogram-aggs-interval-always-0/111472 "2017-12-13T02:02:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![whuang2](https://avatars.discourse-cdn.com/v4/letter/w/47e85d/32.png) [@whuang2](https://discuss.elastic.co/u/whuang2)\
**Post date:** [December 13, 2017, 2:02am UTC](https://discuss.elastic.co/t/date-histogram-aggs-interval-always-0/111472/1 "2017-12-13T02:02:10Z")

</div>

Have java code to build the aggregation and set interval to be "1d", but always get interval:0 in the result query. We are moving from ES2.0 to ES5.5.2, the interval value was "day" in 2.0, now it's "1d". I even print out the interval value and made sure it's "1d" before query execution, but still get "interval" : 0 in actual query and query execution failed.  
Here is the query:

ES query {

"from" : 0,

"size" : 100,

"query" : {

```
"bool" : {

  "must" : [

    {

      "range" : {

        "esLastUpdateTime" : {

          "from" : 1510537538353,

          "to" : 1513129538353,

          "include_lower" : true,

          "include_upper" : true,

          "boost" : 1.0

        }

      }

    },

    {

      "term" : {

        "status" : {

          "value" : "disconnected",

          "boost" : 1.0

        }

      }

    }

  ],

  "disable_coord" : false,

  "adjust_pure_negative" : true,

  "boost" : 1.0

}

```

},

"aggregations" : {

```
"date_histogram_aggs" : {

  "date_histogram" : {

    "field" : "esLastUpdateTime",

    "time_zone" : "-08:00",
    "interval" : 0,

    "offset" : 0,

    "order" : {

      "_key" : "asc"

    },

    "keyed" : false,

    "min_doc_count" : 0

  }

}

```

}

}

---

<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:** [January 10, 2018, 2:02am UTC](https://discuss.elastic.co/t/date-histogram-aggs-interval-always-0/111472/2 "2018-01-10T02:02:23Z")

</div>

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