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

Hi all

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

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

the results I have in ES 1.7.5 is:

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

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

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.

1 Like