provide top N DISTINCT values from suggester API
At the moment the suggester API return the top N results, but if I want use this feature on a field that contains duplicate values, this request could show me N identical values.
For example, my index contains the searchable fields address and city (address as the key) and the city field contains only the cities "Parma" and "Pavia". I want to add autocomplete on the city field on the web app. The suggester API with TOP 5 could give me 5 identical values with the city "pavia". But I like to see both the cities in the TOP 5. A workaround is asking to the suggester API the TOP 100 results and than calculate the distinct values. But I don't like so much this approach.
So, could you provide a way to request directly to the suggester API the TOP 5 DISTINCT values?
It sounds like you might be interested in getting unique terms. For that reason, you might want to try our autocomplete feature https://docs.microsoft.com/en-us/rest/api/searchservice/autocomplete
Carmina Bernabeu Hernandez commented
The problem with autocomplete is that it does not return result as written in the database.
For example if I have this city in the index "Alicante/Alacant", the results from the autocomplete are "alicante alacant".
It removes the upper case and the special characters like "/","(",")","´", etc...