Documents - Get
Retrieves a document from the index.
GET {endpoint}/indexes('{indexName}')/docs('{key}')?api-version=2023-10-01-Preview
GET {endpoint}/indexes('{indexName}')/docs('{key}')?$select={$select}&api-version=2023-10-01-Preview
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
endpoint
|
path | True |
string |
The endpoint URL of the search service. |
index
|
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 |
Lookup |
Response containing the requested document. |
Other Status Codes |
Error response. |
Examples
SearchIndexGetDocument
Sample request
GET https://myservice.search.windows.net/indexes('myindex')/docs('1')?$select=docId,title,description&api-version=2023-10-01-Preview
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 |
An array of details about specific errors that led to this reported error. |
|
message |
string |
A human-readable representation of the error. |