I've a use case where I want to use text field in aggregations. By default text fields are not aggregatable and to make them aggregatable we need to enable fielddata parameter in the mapping.
As enabling fielddata comes with cost of HEAP, I'm wondering if following workaround makes any sense!
- Pre-Analyse( tokenize text field) and make array out of it and index it as Array Type
- After indexing text field as array type(into field called "text_array") I'll get two fields one is text_array (Text Type) and another one is text_array.keyword(Keyword Type)
- As text_array.keyword is type Keyword I can use this in aggregations.
Is creating text_array.keyword makes sense? or does it also consumes HEAP when it is used in aggregations?
Any help on this much appreciated!