RestoreSnapshotAsync()

Restores a snapshot to a target collection.

public async Task<RestoreSnapshotResp> RestoreSnapshotAsync(RestoreSnapshotReq request, CancellationToken cancellationToken = default)

Request Syntax

var request = new RestoreSnapshotReq
{
    SnapshotName = "snapshot_1",
    SourceCollectionName = "my_collection",
    TargetCollectionName = "my_collection_copy"
};

RestoreSnapshotResp result = await client.RestoreSnapshotAsync(request);

REQUEST PARAMETERS:

  • SnapshotName (string) -

    The name of the snapshot to restore.

  • SourceCollectionName (string) -

    The name of the source collection the snapshot belongs to.

  • TargetCollectionName (string) -

    The name of the target collection to restore into.

  • SourceDbName (string?) -

    An optional database name of the source collection. When empty, the client’s currently selected database is used.

  • TargetDbName (string?) -

    An optional database name of the target collection. When empty, the client’s currently selected database is used.

RETURN TYPE:

Task

RETURNS:

A RestoreSnapshotResp object.

  • JobId (long) -

    The restore job ID, which can be passed to GetRestoreSnapshotStateAsync() to poll progress.

EXCEPTIONS:

  • MilvusException

    Thrown when the RPC fails or the server returns an error. Inspect the exception message for details.

Example

using Milvus.Client.V2;
using Milvus.Client.V2.Requests.Snapshot;
using Milvus.Client.V2.Responses.Snapshot;
using Milvus.Client.V2.Types;

using var client = new MilvusClientV2(new ConnectConfig
{
    Uri = "localhost:19530",
    Username = "root",
    Password = "Milvus"
});
await client.ConnectAsync();

RestoreSnapshotResp result = await client.RestoreSnapshotAsync(new RestoreSnapshotReq
{
    SnapshotName = "snapshot_1",
    SourceCollectionName = "my_collection",
    TargetCollectionName = "my_collection_copy"
});

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?