# Aggregation on boolean

**URL:** <https://discuss.elastic.co/t/aggregation-on-boolean/19187>\
**Category:** Elasticsearch\
**Created:** [August 11, 2014, 8:18am UTC](https://discuss.elastic.co/t/aggregation-on-boolean/19187 "2014-08-11T08:18:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fabian\_Kostring](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabian_kostring/32/1310_2.png) [@Fabian\_Kostring](https://discuss.elastic.co/u/Fabian_Kostring)\
**Post date:** [August 11, 2014, 8:18am UTC](https://discuss.elastic.co/t/aggregation-on-boolean/19187/1 "2014-08-11T08:18:25Z")

</div>

Hey there!

I got one index with two types. I want to do a aggragtion query.  
This is my query.

GET index1/type1,type2/\_search  
{  
"query": {  
"match\_all": {}  
},  
"size" : 0,  
"aggs": {  
"myaggregation": {  
"terms": {  
"field": "boolean\_field"  
}  
}  
}  
}

When I execute this query my results are a bit strange.

"aggregations": {  
"myaggregation": {  
"buckets": [  
{  
"key": "F",  
"doc\_count": 12032  
},  
{  
"key": "T",  
"doc\_count": 3388  
},  
{  
"key": "0",  
"doc\_count": 1394  
},  
{  
"key": "1",  
"doc\_count": 259  
}  
]  
}  
}

Why are the aggregations splitted in T,F,0,1 and not combined. F =\> 0, T =\>  
1 ???

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/88e78d7c-d307-4275-bb57-e8dc5c41af11%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/88e78d7c-d307-4275-bb57-e8dc5c41af11%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Fabian\_Kostring](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabian_kostring/32/1310_2.png) [@Fabian\_Kostring](https://discuss.elastic.co/u/Fabian_Kostring)\
**Post date:** [August 11, 2014, 8:51am UTC](https://discuss.elastic.co/t/aggregation-on-boolean/19187/2 "2014-08-11T08:51:21Z")

</div>

Sry!  
It was caused by different indexes.

Am Montag, 11. August 2014 10:18:25 UTC+2 schrieb Fabian Köstring:

> Hey there!
> 
> I got one index with two types. I want to do a aggragtion query.  
> This is my query.
> 
> GET index1/type1,type2/\_search  
> {  
> "query": {  
> "match\_all": {}  
> },  
> "size" : 0,  
> "aggs": {  
> "myaggregation": {  
> "terms": {  
> "field": "boolean\_field"  
> }  
> }  
> }  
> }
> 
> When I execute this query my results are a bit strange.
> 
> "aggregations": {  
> "myaggregation": {  
> "buckets": [  
> {  
> "key": "F",  
> "doc\_count": 12032  
> },  
> {  
> "key": "T",  
> "doc\_count": 3388  
> },  
> {  
> "key": "0",  
> "doc\_count": 1394  
> },  
> {  
> "key": "1",  
> "doc\_count": 259  
> }  
> ]  
> }  
> }
> 
> Why are the aggregations splitted in T,F,0,1 and not combined. F =\> 0, T  
> =\> 1 ???

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4ecd8dd9-5fcb-4727-8249-1c3bf0b3f9b5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4ecd8dd9-5fcb-4727-8249-1c3bf0b3f9b5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:09am UTC](https://discuss.elastic.co/t/aggregation-on-boolean/19187/3 "2017-07-06T01:09:39Z")

</div>


