REST Resource: projects.locations.collections.dataStores.branches.documents

資源:Document

文件會擷取待推薦或搜尋項目的所有原始中繼資料資訊。

JSON 表示法
{
  "name": string,
  "id": string,
  "schemaId": string,
  "content": {
    object (Content)
  },
  "parentDocumentId": string,
  "derivedStructData": {
    object
  },
  "aclInfo": {
    object (AclInfo)
  },
  "indexTime": string,
  "indexStatus": {
    object (IndexStatus)
  },

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "structData": {
    object
  },
  "jsonData": string
  // End of mutually exclusive fields.
}
欄位
name

string

不可變動。文件的完整資源名稱。格式:projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}/branches/{branch}/documents/{documentId}。

這個欄位必須是 UTF-8 編碼的字串,長度上限為 1024 個字元。

id

string

不可變動。文件的 ID。

ID 應符合 RFC-1034 標準,長度上限為 128 個字元。

schemaId

string

位於相同資料儲存庫的結構定義 ID。

content

object (Content)

與這份文件連結的非結構化資料。如果這份文件位於 CONTENT_REQUIRED 資料儲存庫中,就只能設定內容,且必須設定內容。

parentDocumentId

string

父項文件的 ID。目前最多支援兩層文件階層。

ID 應符合 RFC-1034 標準,長度上限為 63 個字元。

derivedStructData

object (Struct format)

僅供輸出。這個欄位是 OUTPUT_ONLY。當中包含原始輸入文件中沒有的衍生資料。

aclInfo

object (AclInfo)

文件的存取控管資訊。

indexTime

string (Timestamp format)

僅供輸出。文件上次編入索引的時間。

如果這個欄位已填入資料,表示文件已編入索引。文件建立索引之後,通常幾秒內即可搜尋,但有時可能需要數小時。

如果這個欄位未填入資料,表示文件從未編入索引。

使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例:"2014-10-02T15:01:23Z"、"2014-10-02T15:01:23.045123456Z" 或 "2014-10-02T15:01:23+05:30"。

indexStatus

object (IndexStatus)

僅供輸出。文件的索引狀態。

  • 如果文件成功編入索引,系統會填入 indexTime 欄位。
  • 否則,如果文件因錯誤而未編入索引,系統會填入 errorSamples 欄位。
  • 否則,如果文件索引正在進行中,系統會填入 pendingMessage 欄位。
資料呈現方式。請提供 struct_data 或 json_data,否則系統會擲回 INVALID_ARGUMENT 錯誤。以下列出互斥的欄位。回應中最多只會設定一個欄位:
structData

object (Struct format)

文件的結構化 JSON 資料。它應符合已註冊的 Schema,否則會擲回 INVALID_ARGUMENT 錯誤。

jsonData

string

文件的 JSON 字串表示法。它應符合已註冊的 Schema,否則會擲回 INVALID_ARGUMENT 錯誤。

互斥欄位的結尾。

內容

與這份文件連結的非結構化資料。

JSON 表示法
{
  "mimeType": string,

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "rawBytes": string,
  "uri": string
  // End of mutually exclusive fields.
}
欄位
mimeType

string

內容的 MIME 類型。支援的類型:

  • application/pdf (PDF,目前僅支援原生 PDF)
  • text/html (HTML)
  • text/plain (TXT)
  • application/xml 或 text/xml (XML)
  • application/json (JSON)
  • application/vnd.openxmlformats-officedocument.wordprocessingml.document (DOCX)
  • application/vnd.openxmlformats-officedocument.presentationml.presentation (PPTX)
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (XLSX)
  • application/vnd.ms-excel.sheet.macroenabled.12 (XLSM)

只有在資料儲存庫中啟用版面配置剖析器時,系統才會支援下列類型:

  • image/bmp (BMP)
  • image/gif (GIF)
  • image/jpeg (JPEG)
  • image/png (PNG)
  • image/tiff (TIFF)

請參閱 https://www.iana.org/assignments/media-types/media-types.xhtml。

非結構化文件的內容。以下列出互斥的欄位。回應中最多只會設定一個欄位:
rawBytes

string (bytes format)

以位元組串流表示的內容。長度上限為 1,000,000 個位元組 (1 MB / ~0.95 MiB)。

注意:與所有 bytes 欄位一樣,這個欄位在 Protocol Buffers 中會以純二進位表示,在 JSON 中則會以 Base64 編碼字串表示。舉例來說,abc123!?$*&()'-=@~ 在 JSON 中應表示為 YWJjMTIzIT8kKiYoKSctPUB+。請參閱 https://developers.google.com/protocol-buffers/docs/proto3#json。

Base64 編碼字串。

uri

string

內容的 URI。僅支援 Cloud Storage URI (例如 gs://bucket-name/path/to/file)。文字格式的檔案大小上限為 2.5 MB,其他格式則為 200 MB。

互斥欄位的結尾。

AclInfo

文件的 ACL 資訊。

JSON 表示法
{
  "readers": [
    {
      object (AccessRestriction)
    }
  ]
}
欄位
readers[]

object (AccessRestriction)

文件的讀取者。

AccessRestriction

AclRestriction,用於限制模型複雜的繼承限制。

範例:模擬「許可」繼承,使用者必須有上層文件的存取權,才能存取子項文件。

文件階層 - Space_S --> Page_P。

讀者:Space_S:group_1、user_1 Page_P:group_2、group_3、user_2

Space_S ACL Restriction - { "aclInfo": { "readers": [ { "principals": [ { "groupId": "group_1" }, { "userId": "user_1" } ] } ] } }

Page_P ACL Restriction。{ "aclInfo": { "readers": [ { "principals": [ { "groupId": "group_2" }, { "groupId": "group_3" }, { "userId": "user_2" } ], }, { "principals": [ { "groupId": "group_1" }, { "userId": "user_1" } ], } ] } }

JSON 表示法
{
  "principals": [
    {
      object (Principal)
    }
  ],
  "idpWide": boolean
}
欄位
principals[]

object (Principal)

主體清單。

idpWide

boolean

身分識別提供者中的所有使用者。

主體

使用者或群組的主體 ID。

JSON 表示法
{

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "userId": string,
  "groupId": string,
  "externalEntityId": string
  // End of mutually exclusive fields.
}
欄位
聯集欄位主體。主體可以是使用者或群組。以下列出互斥的欄位。回應中最多只會設定一個欄位:
userId

string

使用者 ID。如果是 Google Workspace 使用者帳戶,userId 應為 Google Workspace 使用者電子郵件地址。如果是非 Google 識別資訊提供者使用者帳戶,userId 是在 workforcepool 設定期間設定的對應使用者 ID。

groupId

string

群組 ID。如果是 Google Workspace 使用者帳戶,groupId 應為 Google Workspace 群組電子郵件地址。如果是非 Google 識別資訊提供者使用者帳戶,groupId 是在 workforcepool 設定期間設定的對應群組 ID。

externalEntityId

string

適用於客戶身分識別提供者中沒有的第三方應用程式身分。

互斥欄位的結尾。

IndexStatus

文件的索引狀態。

JSON 表示法
{
  "indexTime": string,
  "errorSamples": [
    {
      object (Status)
    }
  ],
  "pendingMessage": string
}
欄位
indexTime

string (Timestamp format)

文件編入索引的時間。如果這個欄位已填入資料,表示文件已編入索引。文件建立索引之後,通常幾秒內即可搜尋,但有時可能需要數小時。

使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例:"2014-10-02T15:01:23Z"、"2014-10-02T15:01:23.045123456Z" 或 "2014-10-02T15:01:23+05:30"。

errorSamples[]

object (Status)

索引文件時發生錯誤的範例。如果這個欄位已填入資料,表示文件發生錯誤,因此未編入索引。

pendingMessage

string

不可變動。這則訊息表示系統正在建立文件索引。如果這個欄位已填入資料,表示文件索引正在等待處理。

方法

create

建立 Document。

delete

刪除 Document。

get

取得 Document。

getProcessedDocument

取得 Document 的已剖析版面配置資訊。

import

大量匯入多個 Document。

list

取得 Document 清單。

patch

更新 Document。

purge

永久刪除分支版本中的所有選取 Document。