GetCollectionStats()

Returns statistics for a collection, such as the row count.

pub async fn get_collection_stats(&self, request: GetCollectionStatsRequest) -> Result<GetCollectionStatsResponse>

Request Syntax

let request = GetCollectionStatsRequest::builder()
    .collection_name("books")
    .build()?;

REQUEST FIELDS:

  • database_name: Option<String>

    Name of the target database; uses the default database when empty.

  • collection_name: String

    Name of the collection to inspect. Required.

RETURNS:

Result

GetCollectionStatsResponse exposes name() returning the collection name, row_count() returning the server-reported row count (when present), and statistics() returning the full key-value statistics map. Returns Error on failure.

Example

let request = GetCollectionStatsRequest::builder()
    .collection_name("books")
    .build()?;
let resp = client.get_collection_stats(request).await?;
println!("row count: {:?}", resp.row_count());

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?