Method: indexing.datasources.items.index

更新 Item ACL、中繼資料和內容。如果 Item 不存在,系統就會插入該函式。這個方法不支援部分更新。系統會將沒有提供值的欄位從 Cloud Search 索引中清除。

您必須具備管理員或服務帳戶才能執行這個 API。使用的服務帳戶已列入對應資料來源的許可清單。

HTTP 要求

POST https://cloudsearch.googleapis.com/v1/indexing/{item.name=datasources/*/items/*}:index

這個網址使用 gRPC 轉碼語法。

路徑參數

參數
item.name

string

商品名稱。格式:datasources/{sourceId}/items/{itemId}

這是必填欄位。長度上限為 1536 個字元。

要求主體

要求主體的資料會採用以下結構:

JSON 表示法
{
  "item": {
    "name": string,
    "acl": {
      "inheritAclFrom": string,
      "aclInheritanceType": enum (ItemAcl.AclInheritanceType),
      "readers": [
        {
          object (Principal)
        }
      ],
      "deniedReaders": [
        {
          object (Principal)
        }
      ],
      "owners": [
        {
          object (Principal)
        }
      ]
    },
    "metadata": {
      "title": string,
      "sourceRepositoryUrl": string,
      "containerName": string,
      "objectType": string,
      "createTime": string,
      "updateTime": string,
      "interactions": [
        {
          object (Interaction)
        }
      ],
      "contentLanguage": string,
      "mimeType": string,
      "searchQualityMetadata": {
        object (SearchQualityMetadata)
      },
      "keywords": [
        string
      ],
      "hash": string,
      "contextAttributes": [
        {
          object (ContextAttribute)
        }
      ]
    },
    "structuredData": {
      "object": {
        object (StructuredDataObject)
      },
      "hash": string
    },
    "content": {
      "contentFormat": enum (ItemContent.ContentFormat),
      "hash": string,

      // Union field content can be only one of the following:
      "inlineContent": string,
      "contentDataRef": {
        object (UploadItemRef)
      }
      // End of list of possible types for union field content.
    },
    "version": string,
    "status": {
      "code": enum (ItemStatus.Code),
      "processingErrors": [
        {
          object (ProcessingError)
        }
      ],
      "repositoryErrors": [
        {
          object (RepositoryError)
        }
      ]
    },
    "queue": string,
    "payload": string,
    "itemType": enum (Item.ItemType)
  },
  "connectorName": string,
  "mode": enum (RequestMode.Mode),
  "debugOptions": {
    object (DebugOptions)
  },
  "indexItemOptions": {
    object (IndexItemOptions)
  }
}
欄位
item.acl

object (ItemAcl)

這個項目的存取控制清單 (ACL)。

item.metadata

object (ItemMetadata)

中繼資料資訊。

item.structuredData

object (ItemStructuredData)

項目的結構化資料,必須符合資料來源結構定義中已註冊的物件定義。

item.content

object (ItemContent)

要建立索引的項目內容,並讓文字可供搜尋。

item.version

string (bytes format)

必要欄位。索引系統會將資料來源的版本儲存為位元組字串,並將索引中的項目版本與使用詞序排列的佇列項目版本進行比較。

如果已排入佇列的項目版本值小於或等於目前已建立索引的項目版本,Cloud Search Indexing API 就不會將其編入索引或刪除。這個欄位的長度上限為 1,024 個位元組。

如要瞭解項目版本對刪除程序的影響,請參閱「手動刪除後處理修訂版本」。

Base64 編碼的字串。

item.status

object (ItemStatus)

項目狀態。僅限輸出的欄位。

item.queue

string

加入這個項目的佇列。長度上限為 100 個半形字元。

item.payload

string (bytes format)

可儲存這個項目的其他狀態連接器。長度上限為 10,000 個位元組。

Base64 編碼的字串。

item.itemType

enum (Item.ItemType)

這個項目的類型。

connectorName

string

發出這項呼叫的連接器名稱。

格式:datasources/{sourceId}/connectors/{ID}

mode

enum (RequestMode.Mode)

必要欄位。這項要求的 RequestMode。

debugOptions

object (DebugOptions)

常見的偵錯選項。

indexItemOptions

object (IndexItemOptions)

回應主體

如果成功,回應主體會包含 Operation 的執行例項。

授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/cloud_search.indexing
  • https://www.googleapis.com/auth/cloud_search

詳情請參閱授權指南

IndexItemOptions

JSON 表示法
{
  "allowUnknownGsuitePrincipals": boolean
}
欄位
allowUnknownGsuitePrincipals

boolean

指定索引要求是否應允許不存在或遭刪除的 Google Workspace 主體。