# Sorting on an analyzed field

**URL:** <https://discuss.elastic.co/t/sorting-on-an-analyzed-field/4319>\
**Category:** Elasticsearch\
**Created:** [April 29, 2011, 3:36pm UTC](https://discuss.elastic.co/t/sorting-on-an-analyzed-field/4319 "2011-04-29T15:36:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Cook](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@James\_Cook](https://discuss.elastic.co/u/James_Cook)\
**Post date:** [April 29, 2011, 3:36pm UTC](https://discuss.elastic.co/t/sorting-on-an-analyzed-field/4319/1 "2011-04-29T15:36:36Z")

</div>

We have a field on a document type called title. It is an analyzed field,  
but when we sort on it, we get a QueryException. I suppose this is caused  
because ES does not know how to sort the resulting list of tokens.

A custom score won't work because this is a alphabetic sorting problem. Are  
there any recommended ways to work around this limitation?

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [April 29, 2011, 3:42pm UTC](https://discuss.elastic.co/t/sorting-on-an-analyzed-field/4319/2 "2011-04-29T15:42:13Z")

</div>

Hi James

On Fri, 2011-04-29 at 11:36 -0400, James Cook wrote:

> We have a field on a document type called title. It is an analyzed  
> field, but when we sort on it, we get a QueryException. I suppose this  
> is caused because ES does not know how to sort the resulting list of  
> tokens.

You can make it a multi-field and store a not\_analyzed version, then you  
can sort by that sub-field instead.

clint

---

<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:** [July 6, 2017, 4:07am UTC](https://discuss.elastic.co/t/sorting-on-an-analyzed-field/4319/3 "2017-07-06T04:07:24Z")

</div>


