Unexpected results from aggregations


(Jean Sebastien Vachon) #1

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
}
}
}
}


(system) #2