Microsoft Azure Cognitive Search Console
Quick Start

Microsoft Azure Cognitive Search provides a REST interface for querying index data.

Prerequisites

Basically, the following is required to use the Rest API:

  • Requests must be issued over HTTPS (on the default port 443).

  • Request URIs must include the api-version. The value must be set to a supported version, formatted as shown in this example:

    GET https://[search service name].search.windows.net/indexes?api-version=2020-06-30
  • Request headers must include either an api-key or a bearer token for authenticated connections. Optionally, you can set the Accept HTTP header. If the content type header isn’t set, the default is assumed to be application/json.

Further information on authentication can be found in the vendor documentation: Azure AI Search REST API reference - Permissions and access control.

Querying the search index

If the conditions described above are met, the index can be queried via GET or POST:

  • GET request:

    GET https://[service name].search.windows.net/indexes/[index name]/docs?[query parameters]
      Content-Type: application/json
      api-key: [admin or query key]
  • POST request:

    POST https://[service name].search.windows.net/indexes/[index name]/docs/search?api-version=[api-version]
      Content-Type: application/json
      api-key: [admin or query key]

The following example query searches the index "raytion-index" for all documents containing the word "test":

GET 'https://raytion.search.windows.net/indexes/raytion-index/docs?search="test"&api-version=2020-06-30&$select=id' \
--header 'Content-Type: application/json' \
--header 'api-key: AAAAAAAABBBBBBBBCCCCCCCCCCDDDDDD'