I have a website with a searchbar where users can search for documents.
Currently I am using a term suggester ( https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-term.html ) to provide word suggestions to people as they type their queries.
This approach is 99% perfect, except that I want a greater edit distance / Levenstein distance for the suggestions.
It seems the maximum max_edits is set to 2, which AFAIK means that if a user is typing 'subspace', they have to type 'subspa' before they get a matching suggestion.
I would prefer it is the matching suggestion was available after only 3-4 characters were typed eg.'subs'. It seems this is a limitation within term suggester.
Is there any way of circumventing this and increasing the edit distance, or switching the suggester to prefix functionality?
My issue is that term suggester has a limit of 2 edit distance. Could I solve this problem by adding edge Ngrams to the field which i want to perform autocompletions on?
If there is a specific field you are using autocomplete for, then you can use the "fields" directive to just return that field and not the whole document. Like:
So at index time, you can add a list of terms into your documents which you can use for autocomplete. Or you can use any existing fields in your documents like title, city or whatever makes sense.
Here's a useful comparison of the different autosuggest methods:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.