All Products
Search
Document Center

DashVector:Delete documents

Last Updated:Apr 11, 2024

This topic describes how to delete documents from a collection based on the document ID list by using the HTTP API.

Note

If the ID of a document to be updated does not exist, the delete operation is invalid for the document.

Prerequisites

Method and URL

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

Example

Note
  1. You need to replace YOUR_API_KEY with your API key and YOUR_CLUSTER_ENDPOINT with the endpoint of your cluster in the sample code for the code to run properly.

  2. You need to create a collection named quickstart in advance. For more information, see the "Example" section of the Create a collection topic.

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":"19215409-ea66-4db9-8764-26ce2eb5bb99","code":0,"message":""}

Request parameters

Parameter

Location

Type

Required

Description

{Endpoint}

path

str

Yes

The endpoint of the cluster. You can view the endpoint on the cluster details page in the console.

{CollectionName}

path

str

Yes

The name of the collection.

dashvector-auth-token

header

str

Yes

The API key.

ids

body

array

Yes

The ID list of the documents to be deleted.

partition

body

str

No

The name of the partition.

delete_all

body

bool

No

Specifies whether to delete all data from the partition. If the value is true, the ids parameter must be left empty.

Response parameters

Parameter

Type

Description

Example

code

int

The returned status code. For more information, see Status codes.

0

message

str

The returned message.

success

request_id

str

The unique ID of the request.

19215409-ea66-4db9-8764-26ce2eb5bb99