I've created Azure Search Suggester for "full_name" index field in order to support autocomplete functionality. Now when I use Azure autocomplete REST endpoint by using "search" parameter as a let's say "Lor" I only get back the result "Lorem" not the "Lorem Ipsum". Is there any way to disable tokenization for suggester and to get back full name like "Lorem Ipsum" for the search term "Lor" for autocomplete?
1 Answers
The Autocomplete API is meant to suggest search terms based on incomplete terms one is typing into to the search box (type-ahead). It supports three modes:
oneTerm – Only one term is suggested. If the query has two terms, only the last term is completed. For example:
"washington medic" -> "medicaid", "medicare", "medicine"
twoTerms – Matching two-term phrases in the index will be suggested, for example:
"medic" -> "medicare coverage", "medical assistant"
oneTermWithContext – Completes the last term in a query with two or more terms, where the last two terms are a phrase that exists in the index, for example:
"washington medic" -> "washington medicaid", "washington medical"
The twoTerms mode might work for you. If you're looking for an API that suggests documents based on an incomplete query term, try the Suggestions API. It returns the entire contents of a field that has a Suggester enabled for all documents that matched the query.

- 1,932
- 1
- 11
- 13
-
Unfortunately, twoTerms doesn't work for me. What I am trying to achive is to get back the result only when the searchTerm contains first name. For example, for search term "Janusz " I want to get back the result "Janusz Lembicz". And for the search term "Lembicz" I need to get back empty result. But with twoTerms I get back "Lembicz" when I search for "Lembicz" but I need to get back empty for result for that case. Is there any way to achieve that? – Huso Sep 26 '19 at 14:42
-
That's a very specific example :) You can use the keyword analyzer on the full_name field (optionally adding a lowercase token filter or other normalizing token filters, https://learn.microsoft.com/en-us/azure/search/index-add-custom-analyzers) and use prefix queries to match only on the first term. Similar question here: https://stackoverflow.com/questions/53587309/search-using-startswith-in-azure-search – Yahnoosh Sep 26 '19 at 14:48
-
It is exactly what I want. Thank you very much! :) – Huso Sep 26 '19 at 15:10
-
I've changed index definition. Unfortunately, I am getting the following error :( "The request is invalid. Details: definition : Field 'full_name' in suggester 'name-suggester' uses an unsupported analyzers configuration. Suggesters are only supported with the default analyzer and language analyzers in this version of the API." – Huso Sep 27 '19 at 15:18
-
Disable the Suggester on that field, you won't need it. You'll be using the Search API, not the Suggest API, as in the lined examples. – Yahnoosh Sep 27 '19 at 15:47