Documents - Get
从索引中检索文档。
GET {endpoint}/indexes('{indexName}')/docs('{key}')?api-version=2024-05-01-preview
GET {endpoint}/indexes('{indexName}')/docs('{key}')?$select={$select}&api-version=2024-05-01-preview
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
endpoint
|
path | True |
string |
搜索服务的终结点 URL。 |
|
index
|
path | True |
string |
索引的名称。 |
|
key
|
path | True |
string |
要检索的文档的键。 |
|
api-version
|
query | True |
string |
客户端 API 版本。 |
|
$select
|
query |
string[] |
要检索文档的字段名称列表;未检索的任何字段都将从返回的文档中缺失。 |
请求头
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| x-ms-client-request-id |
string (uuid) |
随请求一起发送的跟踪 ID,以帮助进行调试。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
Lookup |
包含请求的文档的响应。 |
| Other Status Codes |
错误响应。 |
示例
SearchIndexGetDocument
示例请求
GET https://myservice.search.windows.net/indexes('myindex')/docs('1')?$select=docId,title,description&api-version=2024-05-01-preview
示例响应
{
"description": "Cheapest hotel in town",
"docId": "1",
"title": "Nice Hotel"
}
定义
| 名称 | 说明 |
|---|---|
|
Error |
资源管理错误附加信息。 |
|
Error |
错误详细信息。 |
|
Error |
错误响应 |
ErrorAdditionalInfo
资源管理错误附加信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| info |
object |
其他信息。 |
| type |
string |
其他信息类型。 |
ErrorDetail
错误详细信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| additionalInfo |
错误附加信息。 |
|
| code |
string |
错误代码。 |
| details |
错误详细信息。 |
|
| message |
string |
错误消息。 |
| target |
string |
错误目标。 |
ErrorResponse
错误响应
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误对象。 |