This post was most recently updated on October 19th, 2022
When we search a particular text or keyword and want that keyword to be searched within the particular fields only, then we must mention the fields in the “searchFields” in the body. The list of comma-separated field names to search for the specified text. Target fields must be marked as searchable in the index schema. “searchFields” query parameter restricts search to specific fields.
- Method: POST
- URL: https://[name of the search service].windows.net/indexes/[name of the index]/docs/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:
{
“search”:”[search keyword]”,
“orderby”:”search.score() desc”,
“count”: true,
“searchFields”:”[field in which you want to apply the search criteria]”,
“select”:”[fields you want to display with the result]”
}
- Response: 200 OK