restoreExternalSnapshot()

This operation restores an exported snapshot into a new collection and returns its restore job ID. Requires Milvus 3.0.6 or later.

await milvusClient.restoreExternalSnapshot(data: RestoreExternalSnapshotReq)

Request Syntax

await milvusClient.restoreExternalSnapshot({
    target_collection_name: string,
    snapshot_metadata_uri: string,
    external_spec?: string,
    db_name?: string,
    timeout?: number,
    client_request_id?: string,
})

PARAMETERS:

  • target_collection_name (string) -

    [REQUIRED]

    The name of the collection to restore into.

  • snapshot_metadata_uri (string) -

    [REQUIRED]

    The metadata URI of the exported snapshot bundle.

  • external_spec (string) -

    An optional JSON external storage configuration.

  • db_name (string) -

    The name of the database. Optional.

  • timeout (number) -

    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 an error occurs. Default is undefined.

  • client_request_id (string) -

    A trace ID for request tracking. Optional.

RETURNS:

Promise

This method returns a promise that resolves to a RestoreSnapshotResponse object.

{
    job_id: string,
    status:  ResStatus
}

PARAMETERS:

  • job_id (string) -

    The identifier of the asynchronous restore job. Pass this value to getRestoreSnapshotState() to poll for completion.

  • ResStatus

    A ResStatus object.

    • code (number) -

      A code that indicates the operation result. It remains 0 if this operation succeeds.

    • error_code (string | number) -

      An error code that indicates an occurred error. It remains Success if this operation succeeds.

    • reason (string) -

      The reason that indicates the reason for the reported error. It remains an empty string if this operation succeeds.

EXCEPTIONS:

  • Error

    This exception is raised when any error occurs during this operation.

Example

import { MilvusClient } from '@zilliz/milvus2-sdk-node';

const client = new MilvusClient({
    address: 'localhost:19530',
    token: 'root:Milvus',
});

const res = await client.restoreExternalSnapshot({
    target_collection_name: 'restored_collection',
    snapshot_metadata_uri: 's3://bucket/exports/metadata.json',
});
console.log(res.job_id);

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?