# ElasticSearch sorting by text length and huge ignore\_above

**URL:** <https://discuss.elastic.co/t/elasticsearch-sorting-by-text-length-and-huge-ignore-above/365462>\
**Category:** Elasticsearch\
**Created:** [August 23, 2024, 1:44pm UTC](https://discuss.elastic.co/t/elasticsearch-sorting-by-text-length-and-huge-ignore-above/365462 "2024-08-23T13:44:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sukhoy94](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sukhoy94/32/137014_2.png) [@sukhoy94](https://discuss.elastic.co/u/sukhoy94)\
**Post date:** [August 23, 2024, 1:44pm UTC](https://discuss.elastic.co/t/elasticsearch-sorting-by-text-length-and-huge-ignore-above/365462/1 "2024-08-23T13:44:03Z")

</div>

I need to sort my elasticsearch documents by length of a text field. However, this field can sometimes contain a very large amount of text (up to 15000 characters). I am aware that the ignore\_above parameter, which defaults to 256, can be used to limit the length of the text that is indexed.

Is it okay to change the ignore\_above parameter to 15,000 to enable sorting by text length?

Alternatively, would it be a better solution to create an additional field, such as textLength, which contains the length of the text (e.g., textLength: 14000), and then sort by this textLength field?

Thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 23, 2024, 11:13pm UTC](https://discuss.elastic.co/t/elasticsearch-sorting-by-text-length-and-huge-ignore-above/365462/2 "2024-08-23T23:13:28Z")

</div>

I think the limit you mentioned is for keyword fields, not text fields.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood1/32/101255_2.png) [@Mark\_Harwood1](https://discuss.elastic.co/u/Mark_Harwood1)\
**Post date:** [August 24, 2024, 7:27am UTC](https://discuss.elastic.co/t/elasticsearch-sorting-by-text-length-and-huge-ignore-above/365462/3 "2024-08-24T07:27:04Z")

</div>

> [@sukhoy94](#):
>
> Is it okay to change the ignore\_above parameter to 15,000 to enable sorting by text length?

This would be a very inefficient way of sorting by length. Much better to store the length of the text as another field.
