# Sorting non-alphabetic fields alphabetically?

**URL:** <https://discuss.elastic.co/t/sorting-non-alphabetic-fields-alphabetically/101315>\
**Category:** Elasticsearch\
**Created:** [September 21, 2017, 10:28am UTC](https://discuss.elastic.co/t/sorting-non-alphabetic-fields-alphabetically/101315 "2017-09-21T10:28:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeroen1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jeroen1](https://discuss.elastic.co/u/jeroen1)\
**Post date:** [September 21, 2017, 10:28am UTC](https://discuss.elastic.co/t/sorting-non-alphabetic-fields-alphabetically/101315/1 "2017-09-21T10:28:51Z")

</div>

I've got a dataset containing a very high number of documents, let's say a comment and an author. Because of the high number of documents and storage requirements, the author is represented by a author\_id and looked up in a translation table (short author\_id \<--\> text author\_name). So far so good, saves many many GBs/TBs.

There's a new wish to include sorting by author\_name. For a single author\_name this is easy: filtering on the author\_id and done. However if I want to show a result that contains \>1 author\_names, things go wrong since the author\_names are not in alphabetical order. So let's say the translation table contains:

{0:alex, 1:alison, 2:john, 3:michael, 4:aaron, 5:tim}

I'd like to see aaron on top, but because of his author\_id he isn't.

What's a good approah to sort alphabetically on author\_name using a the author\_id field that doesn't represent alphabetical sorted content? Thank you.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 21, 2017, 9:18pm UTC](https://discuss.elastic.co/t/sorting-non-alphabetic-fields-alphabetically/101315/2 "2017-09-21T21:18:47Z")

</div>

You'd have to do this in your client side code.

---

<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:** [October 19, 2017, 9:19pm UTC](https://discuss.elastic.co/t/sorting-non-alphabetic-fields-alphabetically/101315/3 "2017-10-19T21:19:05Z")

</div>

Closed on October 19, 2017, 9:19pm UTC

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