I am trying to add an aggs query in Python's sdk for elasticsarch. Btu I can't seem to be able to make it work. E.g
body = {
"query":{
"bool":{
"must_not":{
"term":{
"dst":"-"
}
}
}
},
"aggs":{
"sources":{
"terms":{
"field":'src'
}
}
}
}
Executing
>>es.indices.validate_query(index="myindex", body=body)
{u'valid': False, u'_shards': {u'successful': 11, u'failed': 0, u'total': 11}}
Executing the same without the 'aggs' key validates correctly. How do I pass the aggregations in a dict like query to use with python library?