# Elasticsearch sort based on a string with special characters

**URL:** <https://discuss.elastic.co/t/elasticsearch-sort-based-on-a-string-with-special-characters/92680>\
**Category:** Elasticsearch\
**Created:** [July 11, 2017, 3:15pm UTC](https://discuss.elastic.co/t/elasticsearch-sort-based-on-a-string-with-special-characters/92680 "2017-07-11T15:15:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emer](https://avatars.discourse-cdn.com/v4/letter/e/ecae2f/32.png) [@emer](https://discuss.elastic.co/u/emer)\
**Post date:** [July 11, 2017, 3:15pm UTC](https://discuss.elastic.co/t/elasticsearch-sort-based-on-a-string-with-special-characters/92680/1 "2017-07-11T15:15:22Z")

</div>

I would like to sort all the results I get from a query.  
I would like to sort them in either ascending or descending order.  
This is working perfect in most cases.  
However I have noticed if I sort on a field that is a string that contains special characters then is does not work.  
Is there a way to sort on a field which is a string containing special characters.

---

<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:** [July 11, 2017, 3:32pm UTC](https://discuss.elastic.co/t/elasticsearch-sort-based-on-a-string-with-special-characters/92680/2 "2017-07-11T15:32:49Z")

</div>

You probably need to apply an asciifolding normalizer. See [https://www.elastic.co/guide/en/elasticsearch/reference/5.5/analysis-normalizers.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/analysis-normalizers.html)

But it depends on what you are calling "special". May be worth a fully working example as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21)?

---

<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:** [August 8, 2017, 3:33pm UTC](https://discuss.elastic.co/t/elasticsearch-sort-based-on-a-string-with-special-characters/92680/3 "2017-08-08T15:33:08Z")

</div>

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