milvus-logo
LFAI
< Docs
  • Go

DeleteByPks()

This method deletes the specified entities from a collection.

func (c *GrpcClient) DeleteByPks(ctx context.Context, collName string, partitionName string, ids entity.Column) error

Request Parameters

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

collName

Name of the collection from which entities are deleted.

string

partitionName

Name of the partition to update or insert data into.

string

ids

IDs of the entities to delete.

entity.Column

Return

Null

Errors

Any error in the execution of the request. Possible errors are as follows:

  • ErrClientNotReady: The client is not connected to Milvus.

  • ErrCollectionNotExists: The collection with the specified name does not exist.

  • The specified entity does not exist.

  • The call to this API fails.

Example

// delete by pks
ids := entity.NewColumnInt64("id", []int64{0, 1})
errDelete := mc.DeleteByPks(context.Background(), collectionName, "", ids)
if errDelete != nil {
   log.Fatal("failed to delete data:", errDelete.Error())
}

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?