分享
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。
本文介绍如何通过Python SDK获取已创建的Collection的统计信息,如Doc数等。
前提条件
---------------------
* 已创建Cluster:[创建Cluster](https://help.aliyun.com/document_detail/2631966.html?spm=a2c4g.11186623.0.0.4b313165TlgKYY)
* 已获得API-KEY:[API-KEY管理](https://help.aliyun.com/document_detail/2510230.html?spm=a2c4g.11186623.0.0.4b31567e3CZGFg)
* 已安装最新版SDK:[安装DashVector SDK](https://help.aliyun.com/document_detail/2510231.html?spm=a2c4g.11186623.0.0.4b317b1fOJhqlr)
接口定义
=============
Python示例:
```python
Collection.stats() -> DashVectorResponse
```
使用示例
=============
**说明**
1. 需要使用您的api-key替换示例中的YOUR_API_KEY、您的Cluster Endpoint替换示例中的YOUR_CLUSTER_ENDPOINT,代码才能正常运行。
2. 本示例需要参考[新建Collection-使用示例](https://help.aliyun.com/document_detail/2510242.html?spm=a2c4g.11186623.0.0.4b31427bHUxSR2#hivl6)提前创建好名称为`quickstart`的Collection。
Python示例:
```python
import dashvector
client = dashvector.Client(
api_key='YOUR_API_KEY',
endpoint='YOUR_CLUSTER_ENDPOINT'
)
collection = client.get(name='quickstart')
ret = collection.stats()
print(ret)
# example output:
# {
# "request_id": "14448bcb-c9a3-49a8-9152-0de3990bce59",
# "code": 0,
# "message": "Success",
# "output": {
# "total_doc_count": "26",
# "index_completeness": 1.0,
# "partitions": {
# "default": {
# "total_doc_count": "26"
# }
# }
# }
# }
```
入参描述
=============
无
[点击了解更多关于向量检索服务 DashVector信息,可进行免费试用~](https://www.aliyun.com/product/ai/dashvector)
有疑问加站长微信联系(非本文作者))
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
关注微信210 次点击
添加一条新回复
(您需要 后才能回复 没有账号 ?)
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码` - 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传