Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support set consistency level on delete request #312

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions milvus/grpc/Data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ export class Data extends Collection {
* @param {string} data.collection_name - The name of the collection.
* @param {string} [data.partition_name] - The name of the partition (optional).
* @param {string} data.expr - Boolean expression used to filter entities for deletion.
* @param {string} [data.consistency_level] - The consistency level of the new collection. Can be "Strong" (Milvus default), "Session", "Bounded", "Eventually", or "Customized".
* @param {number} [data.timeout] - An optional duration of time in milliseconds to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined.
*
* @returns {Promise<MutationResult>} The result of the operation.
Expand Down Expand Up @@ -355,6 +356,7 @@ export class Data extends Collection {
* @param {string} [data.partition_name] - The name of the partition (optional).
* @param {(string[] | number[])} [data.ids] - IDs of the entities to delete.
* @param {string} [data.filter] - Filter expression, takes precedence over ids.
* @param {string} [data.consistency_level] - The consistency level of the new collection. Can be "Strong" (Milvus default), "Session", "Bounded", "Eventually", or "Customized".
* @param {string} [data.expr] - equals to data.filter.
* @param {number} [data.timeout] - Optional duration of time in milliseconds to allow for the RPC. If undefined, the client keeps waiting until the server responds or an error occurs. Default is undefined.
*
Expand Down
19 changes: 13 additions & 6 deletions milvus/types/Data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,27 @@ export interface InsertReq extends collectionNameReq {
transformers?: InsertTransformers; // provide custom data transformer for specific data type like bf16 or f16 vectors
}

export interface DeleteEntitiesReq extends collectionNameReq {
interface BaseDeleteReq extends collectionNameReq {
partition_name?: string; // partition name
consistency_level?:
| 'Strong'
| 'Session'
| 'Bounded'
| 'Eventually'
| 'Customized'; // consistency level
}

export interface DeleteEntitiesReq extends BaseDeleteReq {
filter?: string; // filter expression
expr?: string; // alias for filter
partition_name?: string; // partition name
}

export interface DeleteByIdsReq extends collectionNameReq {
export interface DeleteByIdsReq extends BaseDeleteReq {
ids: string[] | number[]; // primary key values
partition_name?: string; // partition name
}

export interface DeleteByFilterReq extends collectionNameReq {
export interface DeleteByFilterReq extends BaseDeleteReq {
filter: string; // filter expression
partition_name?: string; // partition name
}

export type DeleteReq = DeleteByIdsReq | DeleteByFilterReq;
Expand Down
1 change: 1 addition & 0 deletions test/grpc/Data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ describe(`Data.API`, () => {
await milvusClient.deleteEntities({
collection_name: COLLECTION_NAME,
expr: 'id in [2,6]',
consistency_level: 'Strong',
});

const res = await milvusClient.query({
Expand Down
Loading