Method: projects.locations.collections.dataStores.userEvents.purge
永久刪除篩選條件指定的所有使用者事件。視篩選器指定的事件數量而定,這項作業可能需要數小時或數天才能完成。如要測試篩選器,請先使用 list 指令。
HTTP 要求
POST https://discoveryengine.googleapis.com/v1/{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 說明文件。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-10-19 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-10-19 (世界標準時間)。"],[],[]]