insert()

Aligns insert-row validation for auto-ID fields, function output fields, dynamic fields, and Struct values.

public InsertResp insert(InsertReq request)

Request Syntax

InsertReq.builder()
    .data(data)
    .databaseName(databaseName)
    .collectionName(collectionName)
    .partitionName(partitionName)
    .build();

BUILDER METHODS:

  • data(List<JsonObject> data)

    The rows to insert. Field names and values must conform to the collection schema.

  • databaseName(String databaseName)

    The name of the database. Defaults to the current database when omitted.

  • collectionName(String collectionName)

    The name of the target collection.

  • partitionName(String partitionName)

    The name of the target partition.

RETURN TYPE:

InsertResp

RETURNS:

A InsertResp object that contains the result of this operation.

  • getInsertCnt() (long) -

    The number of entities inserted.

  • getPrimaryKeys() (List) -

    The primary keys generated for the inserted entities.

  • getCost() (Long) -

    The time cost of the insert operation, in milliseconds.

  • EXCEPTIONS:

    • MilvusClientException

      Raised when request validation, transport, or server execution fails. Inspect the exception message for the exact failure reason.

    Example

    Demonstrates insert() with the reviewed v3.0.x API.

    InsertResp response = client.insert(InsertReq.builder()
        .collectionName("books")
        .data(rows)
        .build());
    

    Try Managed Milvus for Free

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

    Get Started
    Feedback

    Was this page helpful?