# Sorting strings containing numbers

**URL:** <https://discuss.elastic.co/t/sorting-strings-containing-numbers/5629>\
**Category:** Elasticsearch\
**Created:** [October 18, 2011, 3:32pm UTC](https://discuss.elastic.co/t/sorting-strings-containing-numbers/5629 "2011-10-18T15:32:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicco](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicco/32/3106_2.png) [@nicco](https://discuss.elastic.co/u/nicco)\
**Post date:** [October 18, 2011, 3:32pm UTC](https://discuss.elastic.co/t/sorting-strings-containing-numbers/5629/1 "2011-10-18T15:32:02Z")

</div>

Hi everyone,

I need to sort some string fields that contain numbers and I would  
like that:  
"abc10" should appear after "abc7"

Unfortunately I don't know the structure of these strings so it has to  
be a bit generic.

I'm now using itu collation but it seems not to work. Here is my index  
declaration

{  
"analysis" : {  
"analyzer" : {  
"collation" : {  
"tokenizer" : "keyword",  
"filter" : ["icu\_collation"]  
}  
}  
}  
}

and the field is:

id: {type: "string", null\_value : "", analyzer : "collation"},

any ideas??

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, 3:51am UTC](https://discuss.elastic.co/t/sorting-strings-containing-numbers/5629/2 "2017-07-06T03:51:37Z")

</div>


