Aggregations on whole of text field

I have a field that I want to be full-text searchable, so I have it stored as type text.

However I want to be able to run aggregations on the entire contents of the field, so a keyword might be preferred.

How can I set up this field as searchable and aggregatable on the entire string? Note, NOT on the words in the string.

I don't believe that fielddata is what I'm after here as that's for the individual words I think.

Thanks! :slight_smile:

Hey @jong99,

For something like this, we usually suggest creating a multi-field. Your index will essentially have one entry stored as text, and another stored as keyword. Check out the docs here for multi-field support: https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.