This topic describes how to check the information of the collection in Milvus.
When interacting with Milvus using Python code, you have the flexibility to choose between PyMilvus and MilvusClient (new). For more information, refer to Python SDK.
from pymilvus import Collection
collection = Collection("book") # Get an existing collection.
collection.schema # Return the schema.CollectionSchema of the collection.
collection.description # Return the description of the collection.
collection.name # Return the name of the collection.
collection.is_empty # Return the boolean value that indicates if the collection is empty.
collection.num_entities # Return the number of entities in the collection.
collection.primary_field # Return the schema.FieldSchema of the primary key field.
collection.partitions # Return the list[Partition] object.
collection.indexes # Return the list[Index] object.
collection.properties # Return the expiration time of data in the collection.
await milvusClient.describeCollection({ // Return the name and schema of the collection.collection_name: "book",
});
await milvusClient.getCollectionStatistics({ // Return the statistics information of the collection.collection_name: "book",
});
collDesc, err := milvusClient.DescribeCollection( // Return the name and schema of the collection.
context.Background(), // ctx"book", // CollectionName
)
if err != nil {
log.Fatal("failed to check collection schema:", err.Error())
}
log.Printf("%v\n", collDesc)
collStat, err := milvusClient.GetCollectionStatistics( // Return the statistics information of the collection.
context.Background(), // ctx"book", // CollectionName
)
if err != nil {
log.Fatal("failed to check collection statistics:", err.Error())
}
R<DescribeCollectionResponse> respDescribeCollection = milvusClient.describeCollection(
// Return the name and schema of the collection.
DescribeCollectionParam.newBuilder()
.withCollectionName("book")
.build()
);
DescCollResponseWrapperwrapperDescribeCollection=newDescCollResponseWrapper(respDescribeCollection.getData());
System.out.println(wrapperDescribeCollection);
R<GetCollectionStatisticsResponse> respCollectionStatistics = milvusClient.getCollectionStatistics(
// Return the statistics information of the collection.
GetCollectionStatisticsParam.newBuilder()
.withCollectionName("book")
.build()
);
GetCollStatResponseWrapperwrapperCollectionStatistics=newGetCollStatResponseWrapper(respCollectionStatistics.getData());
System.out.println("Collection row count: " + wrapperCollectionStatistics.getRowCount());