Documents - Get

Retrieves a document from the index.

GET {endpoint}/indexes('{indexName}')/docs('{key}')?api-version=2023-11-01
GET {endpoint}/indexes('{indexName}')/docs('{key}')?$select={$select}&api-version=2023-11-01

URI Parameters

Name In Required Type Description
endpoint
path True

string

The endpoint URL of the search service.

indexName
path True

string

The name of the index.

key
path True

string

The key of the document to retrieve.

api-version
query True

string

Client Api Version.

$select
query

string[]

List of field names to retrieve for the document; Any field not retrieved will be missing from the returned document.

Request Header

Name Required Type Description
x-ms-client-request-id

string

uuid

The tracking ID sent with the request to help with debugging.

Responses

Name Type Description
200 OK

LookupDocument

Response containing the requested document.

Other Status Codes

SearchError

Error response.

Examples

SearchIndexGetDocument

Sample Request

GET https://myservice.search.windows.net/indexes('myindex')/docs('1')?$select=docId,title,description&api-version=2023-11-01

Sample Response

{
  "description": "Cheapest hotel in town",
  "docId": "1",
  "title": "Nice Hotel"
}

Definitions

SearchError

Describes an error condition for the API.

Name Type Description
code

string

One of a server-defined set of error codes.

details

SearchError[]

An array of details about specific errors that led to this reported error.

message

string

A human-readable representation of the error.