# Sort fields on numeric part, and the alpha part

**URL:** <https://discuss.elastic.co/t/sort-fields-on-numeric-part-and-the-alpha-part/244163>\
**Category:** Elasticsearch\
**Created:** [August 7, 2020, 11:23am UTC](https://discuss.elastic.co/t/sort-fields-on-numeric-part-and-the-alpha-part/244163 "2020-08-07T11:23:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JjOon](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@JjOon](https://discuss.elastic.co/u/JjOon)\
**Post date:** [August 7, 2020, 11:23am UTC](https://discuss.elastic.co/t/sort-fields-on-numeric-part-and-the-alpha-part/244163/1 "2020-08-07T11:23:30Z")

</div>

Hi all,

I am facing the following issue. I have some addresses, and when we sort them on the number, we have a alphanumeric sort. Like :  
1  
11  
2  
etc...

My problem is : this number can contains letters or others chars such dot.  
Some exemples : NULL, 1, 101, 2b 101a, 102b, d1.1, l1, z, ...

I would like to sort them firstly on their numeric part, and then on their alpha part :  
1  
2b  
101  
101a  
102b  
d1.1  
l  
z  
(or something similar)

How can I do that in Elastic ?  
I was looking for splitting my field in differents parts (numeric vs alphanum), and then see if it begins by the num part or the alpha part. Then order it as I can.

I am quite new here, i look at some similar topic but they are just base on 1 caracter so it does not work for me.

Thanks a lot !

---

<div class="post-metadata">

**Author:** ![JjOon](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@JjOon](https://discuss.elastic.co/u/JjOon)\
**Post date:** [August 17, 2020, 1:54pm UTC](https://discuss.elastic.co/t/sort-fields-on-numeric-part-and-the-alpha-part/244163/2 "2020-08-17T13:54:20Z")

</div>

Well, I tried to implement my proposition but I can't make it functionnal.

If somebody has an idea 🙂

---

<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:** [September 14, 2020, 1:55pm UTC](https://discuss.elastic.co/t/sort-fields-on-numeric-part-and-the-alpha-part/244163/3 "2020-09-14T13:55:03Z")

</div>

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