# Strange boundary of extended\_bounds in histogram aggregation

**URL:** <https://discuss.elastic.co/t/strange-boundary-of-extended-bounds-in-histogram-aggregation/130616>\
**Category:** Elasticsearch\
**Created:** [May 4, 2018, 11:26am UTC](https://discuss.elastic.co/t/strange-boundary-of-extended-bounds-in-histogram-aggregation/130616 "2018-05-04T11:26:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xchen](https://avatars.discourse-cdn.com/v4/letter/x/c37758/32.png) [@xchen](https://discuss.elastic.co/u/xchen)\
**Post date:** [May 4, 2018, 11:26am UTC](https://discuss.elastic.co/t/strange-boundary-of-extended-bounds-in-histogram-aggregation/130616/1 "2018-05-04T11:26:59Z")

</div>

I have the histogram query like following:

```
curl -XPOST 'localhost:9200/myindex/data/_search?pretty' -H 'Content-Type: application/json' -d'
{
  "query" : {
    "bool" : {
      "must" : [ {
        "term" : {
          "s" : 123
        }
      }, {
        "range" : {
          "t" : {
            "gte" : 0,
            "lt" : 100
          }
        }
      } ]
    }
  },
  "aggs" : {
    "agg1" : {
      "histogram" : {
        "field" : "t",
        "min_doc_count" : 0,
        "interval" : 100,
        "offset" : 10,
        "extended_bounds" : {
          "min" : 0,
          "max" : 100
        }
      },
      "aggs" : {
        "sum" : {
          "sum" : {
            "field" : "v"
          }
        }
      }
    }
  },
  "size" : 0
}
'

```

However the response give the following return value, please notice the first "key" is -90, which is out of [0,100]. [0,100] is the extended\_bound I define in the query. I wonder how elasticsearch handle extended\_bound when I specify offset.

```
{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : 0.0,
    "hits" : []
  },
  "aggregations" : {
    "agg1" : {
      "buckets" : [
        {
          "key" : -90.0,
          "doc_count" : 0,
          "sum" : {
            "value" : 0.0
          }
        },
        {
          "key" : 10.0,
          "doc_count" : 0,
          "sum" : {
            "value" : 0.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:** [June 1, 2018, 11:27am UTC](https://discuss.elastic.co/t/strange-boundary-of-extended-bounds-in-histogram-aggregation/130616/2 "2018-06-01T11:27:07Z")

</div>

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