# How to sort fuzzy result by Levenshtein distance?

**URL:** <https://discuss.elastic.co/t/how-to-sort-fuzzy-result-by-levenshtein-distance/19700>\
**Category:** Elasticsearch\
**Created:** [September 10, 2014, 7:18am UTC](https://discuss.elastic.co/t/how-to-sort-fuzzy-result-by-levenshtein-distance/19700 "2014-09-10T07:18:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![11151](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/11151/32/1290_2.png) [@11151](https://discuss.elastic.co/u/11151)\
**Post date:** [September 10, 2014, 7:18am UTC](https://discuss.elastic.co/t/how-to-sort-fuzzy-result-by-levenshtein-distance/19700/1 "2014-09-10T07:18:16Z")

</div>

I want that in the search results exact matches had more weight.

Example:  
dest  
test  
tesd  
desd

I want to see such a result by "query" = test  
test (Levenshtein distance = 0)  
dest (Levenshtein distance = 1)  
tesd (Levenshtein distance = 1)  
desd (Levenshtein distance = 2)

But a see:  
dest  
desd  
test  
tesd

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/29655425-c6f1-44a4-b6eb-9520bcc2c208%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/29655425-c6f1-44a4-b6eb-9520bcc2c208%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:03am UTC](https://discuss.elastic.co/t/how-to-sort-fuzzy-result-by-levenshtein-distance/19700/2 "2017-07-06T01:03:30Z")

</div>


