It sounds like the mapping of the Name and Category field is mapped as text which is the field type used for search analysis, not aggregations. In 2.x this would have worked, but would be very inefficient since it uses field data. In 5.x, field data is disabled in ES.
You can check this yourself by looking at the mapping in Dev Tools Console:
GET my_index/my_type/_mapping/field/Name
In order to use the field for aggregations, the type should be keyword.
See: Text type family | Elasticsearch Guide [8.11] | Elastic
...Text fields are not used for sorting and seldom used for aggregations (although the significant terms aggregation is a notable exception).
If you need to index structured content such as email addresses, hostnames, status codes, or tags, it is likely that you should rather use a keyword field.