如何通过HTTP API统计Collection

34 阅读1分钟

 本文介绍如何通过HTTP API获取已创建的Collection的统计信息,如Doc数等。


前提条件

Method与URL

HTTP示例:

GET https://{Endpoint}/v1/collections/{CollectionName}/stats

使用示例

说明

  1. 需要使用您的api-key替换示例中的YOUR_API_KEY、您的Cluster Endpoint替换示例中的YOUR_CLUSTER_ENDPOINT,代码才能正常运行。
  2. 本示例需要参考新建Collection-使用示例提前创建好名称为quickstart的Collection

Shell示例:

curl -H 'dashvector-auth-token: YOUR_API_KEY' \
 https://YOUR_CLUSTER_ENDPOINT/v1/collections/quickstart/stats

# 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"
#       }
#     }
#   }
# }

入参描述

参数Location类型必填说明
{Endpoint}pathstrCluster的Endpoint,可在控制台Cluster详情中查看
{CollectionName}pathstr您已创建的Collection名称
dashvector-auth-tokenheaderstrapi-key

出参描述

字段类型描述示例
codeint返回值,参考返回状态码说明0
messagestr返回消息success
request_idstr请求唯一id19215409-ea66-4db9-8764-26ce2eb5bb99
outputobject参考CollectionStats