# Unexpected results from aggregations

**URL:** <https://discuss.elastic.co/t/unexpected-results-from-aggregations/44614>\
**Category:** Elasticsearch\
**Created:** [March 16, 2016, 8:18pm UTC](https://discuss.elastic.co/t/unexpected-results-from-aggregations/44614 "2016-03-16T20:18:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsvachon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsvachon/32/20893_2.png) [@jsvachon](https://discuss.elastic.co/u/jsvachon)\
**Post date:** [March 16, 2016, 8:18pm UTC](https://discuss.elastic.co/t/unexpected-results-from-aggregations/44614/1 "2016-03-16T20:18:19Z")

</div>

Hi All,

I'm starting to play with ES and I am having a problem figuring what 's wrong with my query below...  
Basically, my query returns no match but the aggregations is returning data. I tried moving the aggs around but I'm receiving an error message. What would be the proper way of fixing this?

{  
"query": {  
"filtered": {  
"query": {  
"bool": {  
"must": {  
"term": {  
"description": "manager"  
}  
},  
"must\_not": {  
"term": {  
"description": "account"  
}  
}  
}  
}  
}  
},  
"filter": {  
"term": {  
"country\_id": 16767  
}  
},  
"aggs": {  
"top\_employers": {  
"terms": {  
"field": "normalized\_employer\_id",  
"size": 10  
}  
}  
}  
}

---

<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 5, 2017, 11:07pm UTC](https://discuss.elastic.co/t/unexpected-results-from-aggregations/44614/2 "2017-07-05T23:07:46Z")

</div>

Closed on July 5, 2017, 11:07pm UTC


