This post was most recently updated on October 19th, 2022
AUTOCOMPLETE
The Autocomplete API finishes a partially typed query input using existing terms in the search index for use in a secondary query
- Method: POST
- URL: https://[name of the search service].windows.net/indexes/[name of the index]/ autocomplete/search?api-version=[api version]
- Authorization:
Type – API Key
Vale- [Value of the Primary Key]
Add to- Header - Headers:
Content-Type- “application/json”
API-Key – [value of the api key] - Body:
{
“autocompleteMode”:”twoTerms”,
“search”: “[search keyword]”,
“searchFields”:”[field in which you want to apply the search criteria]”
}
N.B.:
The “autocompleteMode” is set to oneTerm by default. “oneTerm” returns a single term. “twoTerms” matches on two-term phrases in the index. “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.
Response: 200 OK