如何通过HTTP API删除Doc

53 阅读1分钟

本文介绍如何通过HTTP API,根据id列表删除Collection中已存在的Doc。 说明

如果指定id不存在,则删除对应Doc的操作无效。

前提条件

  • 已创建Cluster
  • 已获得API-KEY

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":""}]}