Method: indexing.datasources.items.index

更新 Item ACL、元数据和内容。如果 Item 不存在,则会插入 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 主账号。