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.
await milvusClient.collectionManager.describeCollection({ // Return the name and schema of the collection.
collection_name: "book",
});
await milvusClient.collectionManager.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());
DescCollResponseWrapper wrapperDescribeCollection = new DescCollResponseWrapper(respDescribeCollection.getData());
System.out.println(wrapperDescribeCollection);
R<GetCollectionStatisticsResponse> respCollectionStatistics = milvusClient.getCollectionStatistics( // Return the statistics information of the collection.
GetCollectionStatisticsParam.newBuilder()
.withCollectionName("book")
.build());
GetCollStatResponseWrapper wrapperCollectionStatistics = new GetCollStatResponseWrapper(respCollectionStatistics.getData());
System.out.println("Collection row count: " + wrapperCollectionStatistics.getRowCount());
describe collection -c book
属性
返回
异常
schema
collection 的 schema 信息。
description
collection 的描述信息。
name
collection 的名称。
is_empty
表示 collection 是否为空的布尔值。
num_entities
collection 中的 entity 数
如果 collection 不存在,触发CollectionNotExistException。
primary_field
collection 的 primary field。
partitions
包含所有 partition 的列表
如果 collection 不存在,触发CollectionNotExistException。
indexes
包含所有索引的列表
如果 collection 不存在,触发CollectionNotExistException 。
参数
说明
collection_name
要查看的 collection 名称。
Property
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>status</code></td>
<td>{ error_code: number, reason: string }</td>
</tr>
<tr>
<td><code>schema</code></td>
<td>Information of all fields in this collection</td>
<tr>
<td><code>collectionID</code></td>
<td> collectionID</td>
</tr>
</tbody>