Home > Azure > Azure API > AZURE COGNITIVE SEARCH: Custom Search- Search Based on one particular field

AZURE COGNITIVE SEARCH: Custom Search- Search Based on one particular field

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

This Article is TAGGED in , , , , . BOOKMARK THE permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">