# Resource upper bounds on keyword sorting

**URL:** https://discuss.elastic.co/t/resource-upper-bounds-on-keyword-sorting/258095
**Category:** Elasticsearch
**Created:** [December 9, 2020, 8:47am UTC](https://discuss.elastic.co/t/resource-upper-bounds-on-keyword-sorting/258095 "2020-12-09T08:47:26Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rex-remind](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rex-remind/32/46637_2.png) [@rex-remind](https://discuss.elastic.co/u/rex-remind)
#### Post date: [December 9, 2020, 8:47am UTC](https://discuss.elastic.co/t/resource-upper-bounds-on-keyword-sorting/258095/1 "2020-12-09T08:47:26Z")

</div>

I was reading through the docs on fielddata and came about [this](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/text.html#before-enabling-fielddata):

> It usually doesn’t make sense to enable fielddata on text fields. Field data is stored in the heap with the [field data cache](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-fielddata.html) because it is expensive to calculate. Calculating the field data can cause latency spikes, and increasing heap usage is a cause of cluster performance issues.
> 
> Most users who want to do more with text fields use [multi-field mappings](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/multi-fields.html) by having both a `text` field for full text searches, and an unanalyzed [`keyword`](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/keyword.html) field for aggregations, as follows:

I then wanted to explore more why keyword would be more performant and came across this [topic](https://discuss.elastic.co/t/performance-of-keyword-vs-fielddata/204742) which explains how it uses the disk and filesystem cache instead of the heap.

My question is, is there still a limit to the cardinality of a keyword field even given its backing by disk and fs cache rather than heap?

E.g. How would sorting by a keyword field perform on a simple query if there are 1M keywords of 32 byte length? 1 Billion? 1 Trillion? What's the upper limit and in what ways would Elasticsearch be bottle-necked?

Thanks

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [January 6, 2021, 8:47am UTC](https://discuss.elastic.co/t/resource-upper-bounds-on-keyword-sorting/258095/2 "2021-01-06T08:47:31Z")

</div>

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