In ElasticSearch 5.x, the fielddata of text fields are disabled by default. And there are two solutions:
- Use the keyword-sub-type as in
{"article": {"type":"text", {"fields": {"keyword":{"type": "keyword"}}}}}
and then use"title.keyword"
in sort, aggregations and queries - Enable fielddata
Solution 1 imposes a maximum size limit of 32766 terms on the field "article" and solution 2 incurs a large memory footprint. Suppose the field "article" is big (imagine 500000+ words), what's the best way to implement this field with low memory footprint, all words can be searched, and no maximum size limit?