通过Python SDK获取Partition的统计信息

本文介绍如何通过Python SDK获取Collection中一个已存在的Partition的统计信息,如Doc数等。

前提条件

  • 已创建Cluster
  • 已获得API-KEY
  • 已安装最新版SDK

接口定义

Python

Collection.stats_partition(name: str) -> DashVectorResponse

使用示例

说明

  1. 需要使用您的api-key替换示例中的YOUR_API_KEY、您的Cluster Endpoint替换示例中的YOUR_CLUSTER_ENDPOINT,代码才能正常运行。

  2. 本示例需要参考新建Collection-使用示例提前创建好名称为quickstart的Collection。

  3. 本示例需要参考新建Partition-使用示例提前创建好名称为shoes的Partition。

Python

import dashvector

client = dashvector.Client(
    api_key='YOUR_API_KEY',
    endpoint='YOUR_CLUSTER_ENDPOINT'
)
collection = client.get(name='quickstart')

ret = collection.stats_partition('shoes')

print(ret)
# {
#     "code":0,
#     "message":"",
#     "requests_id":"330a2bcb-e4a7-4fc6-a711-2fe5f8a24e8c",
#     "output":{
#         "total_doc_count":0
#     }
# }
posted @ 2026-01-05 13:34  DashVector  阅读(3)  评论(0)    收藏  举报