How to do aggregation in Elastic search with a field which has both keyword and text types.
You can run the aggregation on the keyword field. Ie field.keyword