Documents - Get

從索引擷取檔。

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 參數

名稱 位於 必要 類型 Description
endpoint
path True

string

搜尋服務的端點 URL。

indexName
path True

string

索引的名稱。

key
path True

string

要擷取之檔的索引鍵。

api-version
query True

string

用戶端 API 版本。

$select
query

string[]

要為檔擷取的域名清單;未擷取的任何字段都會從傳回的檔中遺失。

要求標頭

名稱 必要 類型 Description
x-ms-client-request-id

string (uuid)

隨要求一起傳送的追蹤標識碼,以協助偵錯。

回應

名稱 類型 Description
200 OK

LookupDocument

包含所要求文件的回應。

Other Status Codes

SearchError

錯誤回應。

範例

SearchIndexGetDocument

範例要求

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

範例回覆

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

定義

SearchError

描述 API 的錯誤狀況。

名稱 類型 Description
code

string

其中一組伺服器定義的錯誤碼。

details

SearchError[]

導致此錯誤之特定錯誤的詳細數據陣列。

message

string

錯誤的人類可讀取表示法。