# Numeric sorting in string field

**URL:** <https://discuss.elastic.co/t/numeric-sorting-in-string-field/78754>\
**Category:** Elasticsearch\
**Created:** [March 15, 2017, 7:21pm UTC](https://discuss.elastic.co/t/numeric-sorting-in-string-field/78754 "2017-03-15T19:21:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manvir\_Basra](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@Manvir\_Basra](https://discuss.elastic.co/u/Manvir_Basra)\
**Post date:** [March 15, 2017, 7:21pm UTC](https://discuss.elastic.co/t/numeric-sorting-in-string-field/78754/1 "2017-03-15T19:21:02Z")

</div>

Even though field is String and can have something other than digits, we would like it sorted numerically.

- numeric numbers sorted numerically first
- anything non-numeric at the end including the empty ones

Looks like this is common problem but i have hard time finding solution. is there anything built in elastic search to solve this problem? any ideas how this can be solved?

1  
2  
3  
10  
11  
20  
21  
30  
32  
2001  
1 to 10  
1, 2, 5  
1A  
2B  
8(1)  
bailey  
Boffey  
Book 1 to 10  
Book H873/2  
BROWN

---

<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:** [April 12, 2017, 7:21pm UTC](https://discuss.elastic.co/t/numeric-sorting-in-string-field/78754/2 "2017-04-12T19:21:11Z")

</div>

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