# \[BUG?\] Discrepancy in boolean-type keys in aggregation buckets between ES 1.7.x and 7.x

**URL:** <https://discuss.elastic.co/t/bug-discrepancy-in-boolean-type-keys-in-aggregation-buckets-between-es-1-7-x-and-7-x/210060>\
**Category:** Elasticsearch\
**Created:** [December 1, 2019, 1:13pm UTC](https://discuss.elastic.co/t/bug-discrepancy-in-boolean-type-keys-in-aggregation-buckets-between-es-1-7-x-and-7-x/210060 "2019-12-01T13:13:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joneslee85](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joneslee85/32/20980_2.png) [@joneslee85](https://discuss.elastic.co/u/joneslee85)\
**Post date:** [December 1, 2019, 1:13pm UTC](https://discuss.elastic.co/t/bug-discrepancy-in-boolean-type-keys-in-aggregation-buckets-between-es-1-7-x-and-7-x/210060/1 "2019-12-01T13:13:53Z")

</div>

Hi all

I have a simple field `purchased` as type `boolean` in my index mapping. When I generate aggregation for:

```auto
...
"aggs": { "terms" : { "field" : "purchased" } }
...

```

the results I have in ES 1.7.5 is:

```auto
"aggregations": {
  "buckets" => [{"key"=>"T", "key_as_string"=>"true", "doc_count"=>2}, {"key"=>"F", "key_as_string"=>"false", "doc_count"=>1}]
}

```

Whilst the key differs in ES 7.4:

```auto
"aggregations": {
  "buckets" => [{"key"=>1, "key_as_string"=>"true", "doc_count"=>2}, {"key"=>0, "key_as_string"=>"false", "doc_count"=>1}]
}

```

So it's seems to me ES 7.x use integer to represent boolean whilst ES 1.7 uses `T|F`. Is it a breaking change or a bug?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 1, 2019, 1:57pm UTC](https://discuss.elastic.co/t/bug-discrepancy-in-boolean-type-keys-in-aggregation-buckets-between-es-1-7-x-and-7-x/210060/2 "2019-12-01T13:57:22Z")

</div>

Yes. This has been introduced sometime between 1.7, 2.x, 5.x, 6.x, 7.x...

I meant that's probably not the only breaking change you'll find.

---

<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:** [December 29, 2019, 1:57pm UTC](https://discuss.elastic.co/t/bug-discrepancy-in-boolean-type-keys-in-aggregation-buckets-between-es-1-7-x-and-7-x/210060/3 "2019-12-29T13:57:22Z")

</div>

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