To focus only on aggregation with the match_all query, you can simply use "size": 0 (this means you don't want the query results) without a query:
curl -XPOST "http://localhost:9200/indexname/doctype/_search" -d' { "size": 0, "aggs": { "my_agg": { "stats": { "field": "country_id" } } } }'
source share