# Sorting on tokenized fields?

**URL:** <https://discuss.elastic.co/t/sorting-on-tokenized-fields/4413>\
**Category:** Elasticsearch\
**Created:** [May 16, 2011, 11:01am UTC](https://discuss.elastic.co/t/sorting-on-tokenized-fields/4413 "2011-05-16T11:01:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maho](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@maho](https://discuss.elastic.co/u/maho)\
**Post date:** [May 16, 2011, 11:01am UTC](https://discuss.elastic.co/t/sorting-on-tokenized-fields/4413/1 "2011-05-16T11:01:18Z")

</div>

Hi,

I've indexed some books and like to sort them by title.

What happens if the field is tokenized, is sorting done anyway, using  
the first term only?

Is there a way to do some sorting anyway, by concatenating all the  
tokens into one string?

Thanks.

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [May 16, 2011, 11:13am UTC](https://discuss.elastic.co/t/sorting-on-tokenized-fields/4413/2 "2011-05-16T11:13:38Z")

</div>

Why not index the title into a separate none-tokenized field?

On May 16, 1:01 pm, maho [mathias.hod...@gmail.com](mailto:mathias.hod...@gmail.com) wrote:

> Hi,
> 
> I've indexed some books and like to sort them by title.
> 
> What happens if the field is tokenized, is sorting done anyway, using  
> the first term only?
> 
> Is there a way to do some sorting anyway, by concatenating all the  
> tokens into one string?
> 
> Thanks.

---

<div class="post-metadata">

**Author:** ![maho](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@maho](https://discuss.elastic.co/u/maho)\
**Post date:** [May 16, 2011, 11:29am UTC](https://discuss.elastic.co/t/sorting-on-tokenized-fields/4413/3 "2011-05-16T11:29:45Z")

</div>

Thanks for your answer.

Yes, that would be one way.  
The disadvantage is that you have to send more data to the server =\>  
more traffic (http).

On 16 Mai, 13:13, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:

> Why not index the title into a separate none-tokenized field?
> 
> On May 16, 1:01 pm, maho [mathias.hod...@gmail.com](mailto:mathias.hod...@gmail.com) wrote:
> 
> > Hi,
> 
> > I've indexed some books and like to sort them by title.
> 
> > What happens if the field is tokenized, is sorting done anyway, using  
> > the first term only?
> 
> > Is there a way to do some sorting anyway, by concatenating all the  
> > tokens into one string?
> 
> > Thanks.

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [May 16, 2011, 5:13pm UTC](https://discuss.elastic.co/t/sorting-on-tokenized-fields/4413/4 "2011-05-16T17:13:50Z")

</div>

This is negligible. Although there is some overhead when indexing.

Also take a look into this:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On May 16, 1:29 pm, maho [mathias.hod...@gmail.com](mailto:mathias.hod...@gmail.com) wrote:

> Thanks for your answer.
> 
> Yes, that would be one way.  
> The disadvantage is that you have to send more data to the server =\>  
> more traffic (http).
> 
> On 16 Mai, 13:13, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:
> 
> > Why not index the title into a separate none-tokenized field?
> 
> > On May 16, 1:01 pm, maho [mathias.hod...@gmail.com](mailto:mathias.hod...@gmail.com) wrote:
> 
> > > Hi,
> 
> > > I've indexed some books and like to sort them by title.
> 
> > > What happens if the field is tokenized, is sorting done anyway, using  
> > > the first term only?
> 
> > > Is there a way to do some sorting anyway, by concatenating all the  
> > > tokens into one string?
> 
> > > 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:** [July 6, 2017, 4:06am UTC](https://discuss.elastic.co/t/sorting-on-tokenized-fields/4413/5 "2017-07-06T04:06:05Z")

</div>


