Common problem when upgrading to Elasticsearch 5.x. Answered here:
- "Fielddata is disabled on text fields by default" error
- Group by String value issue
- Data disappears when grouping a count by a term
So check your mapping to see if you have a keyword index mapping that you can use otherwise you will have to create it.