I am trying to implement a GROUP BY categories_slug, WHERE location_country = 'CA' and location_province = 'ON' in ElasticSearch
{
"aggs": {
"categories": {
"terms": {
"field": "categories.slug",
"order": {
"_term": "asc"
},
"size": 1000
}
}
},
"query": {
"filtered": {
"filter": [
{
"term": {
"locations.country": "CA"
}
},
{
"term": {
"locations.administrative_area_level_1": "QC"
}
}
]
}
}
}
How can I use elastica to achieve this query?
