This topic describes how to check the information of partitions in Milvus.
Verify if a partition exists in the specified collection.
from pymilvus import Collection
collection = Collection("book")
collection.has_partition("novel")
await milvusClient.hasPartition({
collection_name: "book",
partition_name: "novel",
});
hasPar, err := milvusClient.HasPartition(
context.Background(),
"book",
"novel",
)
if err != nil {
log.Fatal("failed to check the partition:", err.Error())
}
log.Println(hasPar)
R<Boolean> respHasPartition = milvusClient.hasPartition(
HasPartitionParam.newBuilder()
.withCollectionName("book")
.withPartitionName("novel")
.build()
);
if (respHasPartition.getData() == Boolean.TRUE) {
System.out.println("Partition exists.");
}
var exists = await milvusClient.GetCollection("book").HasPartitionAsync("novel");
Parameter |
Description |
partition_name |
Name of the partition to check. |
Parameter |
Description |
collection_name |
Name of the collection to check. |
partition_name |
Name of the partition to check. |
Parameter |
Description |
ctx |
Context to control API invocation process. |
CollectionName |
Name of the collection to check. |
partitionName |
Name of the partition to check. |
Parameter |
Description |
collection_name |
Name of the collection to check. |
partition_name |
Name of the partition to check. |
from pymilvus import Collection
collection = Collection("book")
collection.partitions
await milvusClient.showPartitions({
collection_name: "book",
});
listPar, err := milvusClient.ShowPartitions(
context.Background(),
"book",
)
if err != nil {
log.Fatal("failed to list partitions:", err.Error())
}
log.Println(listPar)
R<ShowPartitionsResponse> respShowPartitions = milvusClient.showPartitions(
ShowPartitionsParam.newBuilder()
.withCollectionName("book")
.build()
);
System.out.println(respShowPartitions);
var partitions = await milvusClient.GetCollection("book").ShowPartitionsAsync();
Parameter |
Description |
collection_name |
Name of the collection to check. |
Parameter |
Description |
ctx |
Context to control API invocation process. |
CollectionName |
Name of the collection to check. |
Parameter |
Description |
CollectionName |
Name of the collection to check. |
Parameter |
Description |
collectionName |
Name of the collection to check. |
- Learn more basic operations of Milvus: