Get direct hit first using fuzzy query in autocompletion suggester

I'm using Elasticsearch to provide auto suggestions to names in a database, and I want it to be fuzzy to allow for minor spelling errors. Now I have two names that sound similar, JohnA and JohnB indexed. This is my query:
{
"suggest": {
"suggest": {
"completion": {
"fuzzy": {
"fuzziness":"auto
},
"field": "suggest",
"size": 5
},
"prefix": "JohnB"
}
}
}

The result set contains JohnA before JohnB. Ideally I would want JohnB to appear before JohnA . How can I achieve this while still using fuzziness in the suggest query.

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