createSnapshot()

This operation creates a snapshot for a collection.

public void createSnapshot(CreateSnapshotReq request)

Request Syntax

createSnapshot(CreateSnapshotReq.builder()
    .databaseName(String databaseName)
    .collectionName(String collectionName)
    .snapshotName(String snapshotName)
    .description(String description)
    .compactionProtectionSeconds(Long compactionProtectionSeconds)
    .build()
)

BUILDER METHODS:

  • databaseName(String databaseName)

    The name of the database that contains the collection. If omitted, the current database is used.

  • collectionName(String collectionName)

    The name of the collection associated with the snapshot operation.

  • snapshotName(String snapshotName)

    The name of the snapshot.

  • description(String description)

    A human-readable description for the snapshot.

  • compactionProtectionSeconds(Long compactionProtectionSeconds)

    The number of seconds to protect the snapshot from compaction. Use 0L when no protection window is needed.

RETURNS:

void

EXCEPTIONS:

  • MilvusClientException

    This exception is raised when required parameters are missing, numeric parameters are out of range, or the server returns an error for this operation.

Example

import io.milvus.v2.service.snapshot.request.CreateSnapshotReq;

CreateSnapshotReq request = CreateSnapshotReq.builder()
    .databaseName("default")
    .collectionName("book_chunks")
    .snapshotName("book_chunks_backup")
    .description("Backup before schema migration")
    .compactionProtectionSeconds(3600L)
    .build();

client.createSnapshot(request);

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?