BulkImport
The BulkImport struct is an async client for the Milvus bulk-import REST endpoints. Create one with BulkImport::new(), then use its methods to create import jobs, list jobs, and monitor progress. The create operation is also called bulk import.
pub struct BulkImport
Constructor
Constructs a bulk-import REST client from the given configuration.
pub fn new(config: &BulkImportConfig) -> Result<Self>
PARAMETERS:
config: &BulkImportConfigConnection settings for the bulk-import REST client. The
urlmust be a validhttporhttpsURL containing a host and no query string or fragment. TLS-related fields are validated together.
RETURN TYPE:
Result
RETURNS:
Returns a BulkImport client on success, or Error when the configuration is invalid.
BulkImportConfig
Connection settings for the bulk-import REST client.
pub struct BulkImportConfig
PARAMETERS:
url: StringBase URL of the Milvus bulk-import REST endpoint. Required.
api_key: StringAPI key sent as a
Bearertoken in theAuthorizationheader.timeout: DurationOverall timeout for each HTTP request. A zero duration disables the client-side request timeout. Defaults to 20 seconds.
verify_tls: boolWhether to verify the server’s TLS certificate. Defaults to
true.ca_certificate_path: Option<PathBuf>Path to a PEM CA certificate used to verify the server. Cannot be combined with disabled TLS verification.
client_identity_path: Option<PathBuf>Path to one PEM file containing the client certificate and private key. Cannot be combined with separate client certificate or private-key paths.
client_certificate_path: Option<PathBuf>Path to a PEM client certificate, used together with
client_private_key_path.client_private_key_path: Option<PathBuf>Path to a PEM client private key, used together with
client_certificate_path.
Methods
BulkImport()
Creates a bulk-import job.
pub async fn bulk_import(&self, request: BulkImportRequest) -> Result<BulkImportResponse>
The request must specify exactly one data source among files, object_url, object_urls, and data_paths.
REQUEST FIELDS:
database_name: StringName of the database that holds the collection.
collection_name: StringName of the target collection. Required.
partition_name: StringName of the target partition.
files: Vec<Vec<String>>Local or object-storage paths visible to an open-source Milvus deployment, grouped per import.
object_url: StringDeprecated singular object URL accepted by Milvus 2.6. Prefer
object_urls.object_urls: Vec<Vec<String>>Object URLs of the files to import, grouped per import.
cluster_id: StringCluster ID for Zilliz Cloud deployments. Cannot be combined with
project_idandregion_id.project_id: StringProject ID for Zilliz Cloud deployments. Must be specified together with
region_id.region_id: StringRegion ID for Zilliz Cloud deployments. Must be specified together with
project_id.access_key: StringObject-storage access key. Must be specified together with
secret_key.secret_key: StringObject-storage secret key. Must be specified together with
access_key.token: StringObject-storage session token.
volume_name: StringVolume name, required when
data_pathsis used.data_paths: Vec<Vec<String>>Data paths within the volume to import, grouped per import.
options: HashMap<String, Value>Additional import options, such as
auto_commit.
RETURN TYPE:
Result
RETURNS:
A BulkImportResponse object containing the bulk-import endpoint response. Returns an Error if the operation fails. See BulkImportResponse for its methods.
ListImportJobs()
Lists bulk-import jobs visible to the target deployment.
pub async fn list_import_jobs(&self, request: ListImportJobsRequest) -> Result<BulkImportResponse>
See list_import_jobs for the request fields, response surface, and an example.
GetImportProgress()
Gets the current state and progress of one bulk-import job.
pub async fn get_import_progress(&self, request: GetImportProgressRequest) -> Result<BulkImportResponse>
See get_import_progress for the request fields, response surface, and an example.
Example
let bulk = BulkImport::new(
&BulkImportConfig::new()
.url("http://localhost:19530")
.api_key("root:Milvus"),
)?;