In short, ElasticSearch builds aggregations much faster than MySQL. And the more data, the more significant this difference.
I measured the execution time of requests on the combat server.
Server options
Intel (R) Core (TM) i7-4770K CPU @ 3.50GHz, RAM 30Mb, SSD MySQL 5.6, the number of records in the table - 250258 ElasticSearch 2.4, the same number of documents.
Mysql
select brand_id, count(*) from product group by brand_id
Elasticsearch
time curl -X POST "http://localhost:9200/my_index/product/_search?pretty=true" -d '{"size": 0,"aggs": {"group_by_brand": {"terms": {"field": "brand.id"}}}}'
lead time
MySQL - 55 ... 76ms, average 65.5ms
ElasticSearch - 19 ... 24ms, average 21.5ms
If the data were more than 1 million, the difference would be more significant.
From this we can conclude that the choice depends on the task. If you need to count the number of products in the menu categories and there are not too many of them (<100), then you can safely use MySQL. And if you need to build filters for parametric search, where the number of products is displayed for each filter value, then you should use ElasticSearch only.
Good article in a subject: Use the index, JSON! Aggregation performance