How to sort number stored as string (keyword)

Some numerical attribute in my data is mapped as keyword and stored as string. I want to sort it as 1, 2, 10, 15 or when descending. 15, 10, 2, 1. I have tried multiple solutions available online but nothing works. Data will contain only number as string. There won't be any mix like ABC10.
I can not change mapping and performance is not a big issue


You need to change the mapping (reindex that is). Or use

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