milvus-logo
Star
0
Forks
0
快速开始

Delete Entities

Milvus Docs 需要你的帮助

本文档暂时没有中文版本,欢迎你成为社区贡献者,协助中文技术文档的翻译。
你可以通过页面右边的 编辑 按钮直接贡献你的翻译。更多详情,参考 贡献指南。如需帮助,你可以 提交 GitHub Issue

This topic describes how to delete entities in Milvus.

Milvus supports deleting entities by primary key filtered with boolean expression.

  • Deleted entities can still be retrieved immediately after the deletion if the consistency level is set lower than Strong.
  • Entities deleted beyond the pre-specified span of time for Time Travel cannot be retrieved again.
  • Frequent deletion operations will impact the system performance.

Prepare boolean expression

Prepare the boolean expression that filters the entities to delete. See Boolean Expression Rules for more information.

The following example filters data with primary key values of 0 and 1.

expr = "book_id in [0,1]"
const expr = "book_id in [0,1]";
private static final String DELETE_EXPR = "book_id in [0,1]";
delete entities -c book
The expression to specify entities to be deleted: book_id in [0,1]
Option Description
-c The name of the collection.
-p (Optional) The name of the partition that the entities belong to.

Delete entities

Delete the entities with the boolean expression you created. Milvus returns the ID list of the deleted entities.

from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.delete(expr)
await milvusClient.dataManager.deleteEntities({
  collection_name: "book",
  expr: expr,
});
// This function is under active development on the GO client.
milvusClient.delete(
		DeleteParam.newBuilder()
				.withCollectionName("book")
				.withExpr(DELETE_EXPR)
				.build());
You are trying to delete the entities of collection. This action cannot be undone!
Do you want to continue? [y/N]: y
Parameter Description
expr Boolean expression that specifies the entities to delete.
partition_name (optional) Name of the partition to delete entities from.
Parameter Description
collection_name Name of the collection to delete entities from.
expr Boolean expression that specifies the entities to delete.
partition_name (optional) Name of the partition to delete entities from.
Parameter Description
CollectionName Name of the collection to delete entities from.
expr Boolean expression that specifies the entities to delete.
PartitionName (optional) Name of the partition to delete entities from.

What's next

    该页面是否对你有帮助?
    本页目录