Method: projects.locations.collections.dataStores.userEvents.purge

永久删除指定过滤条件所指定的所有用户事件。此操作可能需要数小时或数天才能完成,具体取决于过滤条件指定的事件数量。如需测试过滤器,请先使用 list 命令。

HTTP 请求

POST https://discoveryengine.googleapis.com/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:purge

网址采用 gRPC 转码语法。

路径参数

参数
parent

string

必需。创建相应事件时所用目录的资源名称。格式为 projects/{project}/locations/global/collections/{collection}/dataStores/{dataStore}

请求正文

请求正文中包含结构如下的数据:

JSON 表示法
{
  "filter": string,
  "force": boolean
}
字段
filter

string

必需。用于指定要删除的事件的过滤条件字符串,长度上限为 5,000 个字符。适合过滤的字段包括:

  • eventType:用双引号括起来的 UserEvent.event_type 字符串。
  • eventTime:采用 ISO 8601“zulu”格式。
  • userPseudoId:双引号字符串。如果指定此字段,则系统会删除与某个访问者关联的所有事件。
  • userId:双引号字符串。如果指定此字段,则系统会删除与某个用户关联的所有事件。

注意:此 API 仅支持清除最多 30 天的数据。

示例:

  • 删除某个时间范围内的所有活动:eventTime > "2012-04-23T18:25:43.511Z" eventTime < "2012-04-23T18:30:43.511Z"
  • 删除某个时间范围内的特定 eventType:eventTime > "2012-04-23T18:25:43.511Z" eventTime < "2012-04-23T18:30:43.511Z" eventType = "search"
  • 删除特定时间范围内特定访问者的所有事件:eventTime > "2012-04-23T18:25:43.511Z" eventTime < "2012-04-23T18:30:43.511Z" userPseudoId = "visitor1024"
  • 删除 DataStore 中过去 30 天的事件:*

过滤字段之间采用隐式 AND 关系。

force

boolean

目前不支持 force 字段。完全清除用户事件请求会永久删除所有可清除的事件。开发完成后:如果 force 设置为 false,该方法会返回预期的完全清除计数,但不删除任何用户事件。如果请求中未包含此字段,则此字段将默认为 false。

响应正文

如果成功,则响应正文包含一个 Operation 实例。

授权范围

需要以下 OAuth 范围之一:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/discoveryengine.readwrite
  • https://www.googleapis.com/auth/discoveryengine.assist.readwrite

如需了解详情,请参阅 Authentication Overview

IAM 权限

需要拥有 parent 资源的以下 IAM 权限:

  • discoveryengine.userEvents.purge

如需了解详情,请参阅 IAM 文档