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)

此項目的存取控制清單。

item.metadata

object (ItemMetadata)

中繼資料資訊。

item.structuredData

object (ItemStructuredData)

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

item.content

object (ItemContent)

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

item.version

string (bytes format)

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

Cloud Search 索引服務不會為任何已排入佇列的項目建立索引,或刪除這些項目,除非這些項目的版本值小於或等於目前已建立索引的項目的版本。這個欄位的長度上限為 1024 位元組。

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

Base64 編碼字串。

item.status

object (ItemStatus)

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

item.queue

string

項目所屬的佇列。長度上限為 100 個半形字元。

item.payload

string (bytes format)

其他狀態連接器可以為此項目儲存狀態。長度上限為 10000 個位元組。

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 授權對象。