本文由簡體中文內容自動轉碼而成。阿里雲不保證此自動轉碼的準確性、完整性及時效性。本文内容請以簡體中文版本為準。

刪除Doc

更新時間:2024-07-13 00:21

本文介紹如何通過HTTP API,根據id列表刪除Collection中已存在的Doc。

說明

如果指定id不存在,則刪除對應Doc的操作無效。

前提條件

Method與URL

HTTP
DELETE https://{Endpoint}/v1/collections/{CollectionName}/docs

使用樣本

說明
  1. 需要使用您的api-key替換樣本中的YOUR_API_KEY、您的Cluster Endpoint替換樣本中的YOUR_CLUSTER_ENDPOINT,代碼才能正常運行。

  2. 本樣本需要參考建立Collection-使用樣本提前建立好名稱為quickstart的Collection

Shell
curl -XDELETE \
  -H 'dashvector-auth-token: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"ids": ["1", "2"]}' https://YOUR_CLUSTER_ENDPOINT/v1/collections/quickstart/docs

# example output:
# {"request_id":"a0d1fa36-3d66-4f85-b8d6-40bc28cdc196","code":0,"message":"Success","output":[{"doc_op":"delete","id":"1","code":0,"message":""},{"doc_op":"delete","id":"2","code":0,"message":""}]}

入參描述

參數

Location

類型

必填

說明

{Endpoint}

path

str

Cluster的Endpoint,可在控制台Cluster詳情中查看

{CollectionName}

path

str

Collection名稱

dashvector-auth-token

header

str

api-key

ids

body

array

待刪除的Doc id列表

partition

body

str

Partition名稱

delete_all

body

bool

是否刪除全部partition資料,注意為true時,ids參數須為空白

出參描述

欄位

類型

描述

樣本

code

int

傳回值,參考返回狀態代碼說明

0

message

str

返回訊息

success

request_id

str

請求唯一id

19215409-ea66-4db9-8764-26ce2eb5bb99

output

array

返回刪除的結果,DocOpResult列表

  • 本頁導讀 (1, M)
  • 前提條件
  • Method與URL
  • 使用樣本
  • 入參描述
  • 出參描述
文檔反饋