< Docs
  • Java
    • v1


A MilvusClient interface. This method imports data from external files, currently supports JSON/Numpy/Parquet files. Read the doc for details.

R<ImportResponse> bulkInsert(BulkInsertParam requestParam);


Use the BulkInsertParam.Builder to construct a BulkInsertParam object.

import io.milvus.param.BulkInsertParam;
BulkInsertParam.Builder builder = BulkInsertParam.newBuilder();

Methods of BulkInsertParam.Builder:

Method Description Parameters
withCollectionName(String collectionName) Sets the collection name. Collection name cannot be empty or null. collectionName: The name of the target collection.
withPartitionName(String partitionName) Sets the partition name. partition name can be null. partitionName: The name of the target partition.
withFiles(List\ files) Sets the path of the files. The paths cannot be empty or null.
Each file path must be a relative path under the Milvus storage bucket.
files: A file paths list. Currently, you can only input one row-based JSON file for each call.
addFile(String file) Set a file path to be imported.The paths cannot be empty or null. file: A file path.
build() Constructs a BulkInsertParam object. N/A

The can throw the following exceptions:

  • ParamException: error if the parameter is invalid.


This method catches all the exceptions and returns an R<ImportResponse> object.

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknown and the error message of the exception.

  • If the API succeeds, it returns a valid ImportResponse held by the R template. You can use ImportResponse to get the task ID.


import io.milvus.param.bulkinsert.*;

List<String> files = Arrays.asList("/path_to_bucket/data.json");
R<ImportResponse> response = milvusClient.bulkInsert(BulkInsertParam.newBuilder()
if (response.getStatus() != R.Status.Success.getCode()) {