メインコンテンツまでスキップ

delete()

Addedv2.3.xModifiedv2.5.x

This operation deletes entities by their IDs or with a boolean expression.

delete(data): Promise<MutationResult>

Request Syntax

This method has the following alternatives.

With DeleteByIdsReq

milvusClient.delete({
db_name: string,
collection_name: string,
partition_name?: string,
ids: string[] | number[],
consistency_level: string,
timeout?: number
})

PARAMETERS:

  • db_name (string) -

    The name of the database that holds the target collection.

  • collection_name (string) -

    [REQUIRED]

    The name of an existing collection.

  • partition_name (string) -

    The name of an existing partition in the collection.

  • ids (string[] | number[]) -

    [REQUIRED]

    A specific entity ID or a list of entity IDs.

    The value defaults to None, indicating that a scalar filtering condition applies.

  • consistency_level (ConsistencyLevelEnum) -

    The consistency level of the target collection. The value defaults to Bounded (1) with options of Strong (0), Bounded (1), Session (2), and Eventually (3).

  • timeout (number) -

    The timeout duration for this operation.

    Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.

RETURNS Promise<MutationResult>

With DeleteByFilterReq

milvusClient.delete({
db_name: string,
collection_name: string,
partition_name?: string,
filter: string,
exprValues?: keyValueObject,
consistency_level?: string,
timeout?: number
})

PARAMETERS:

  • db_name (string) -

    The name of the database that holds the target collection.

  • collection_name (string) -

    [REQUIRED]

    The name of an existing collection.

  • partition_name (string) -

    The name of an existing partition in the collection.

  • filter (string) -

    A scalar filtering condition to filter matching entities.

    The value defaults to an empty string, indicating that no condition applies. Setting both ids and filter results in a ParamError exception.

    You can set this parameter to an empty string to skip scalar filtering. To build a scalar filtering condition, refer to Boolean Expression Rules.

  • consistency_level (ConsistencyLevelEnum) -

    The consistency level of the target collection. The value defaults to Bounded (1) with options of Strong (0), Bounded (1), Session (2), and Eventually (3).

  • timeout (number) -

    The timeout duration for this operation.

    Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.

RETURNS Promise<MutationResult>

Example

const milvusClient = new milvusClient(MILUVS_ADDRESS);
const resStatus = await milvusClient.delete({
collection_name: 'my_collection',
ids: [1,2,3,4]
});