You need to enable JavaScript to run this app.
导航

info

最近更新时间2024.04.16 13:11:48

首次发布时间2023.11.03 15:00:09

概述

/collection/info 接口用于查询指定数据集 Collection 的详情信息。

请求接口

说明

请求向量数据库 VikingDB 的 OpenAPI 接口时,需要构造签名进行鉴权,详细的 OpenAPI 签名调用方法请参见 API签名调用指南

URI

/api/collection/info

统一资源标识符

方法

GET

客户端对向量数据库服务器请求的操作类型

请求头

Content-Type: application/json

请求消息类型

Authorization: HMAC-SHA256 ***

鉴权

请求参数

参数

类型

是否必选

参数说明

collection_name/collection_alias

string

指定查询的 Collection 名称/别名。

  • 只能使用英文字母、数字、下划线_,并以英文字母开头,不能为空。
  • 长度要求:[1, 128]。

响应消息

参数

参数说明

code

状态码

message

返回信息

request_id

标识每个请求的唯一标识符

data

Collection详情,详见 Collection 参数说明。

Collection 参数

参数

子参数

类型

参数说明

collection_name

string

显示查询的 Collection 名称。

description

string

显示查询的 Collection 的描述。

collection_aliases

array

显示查询的别名列表。

primary_key

string

显示以下定义的某个 field_name 作为主键字段名称,主键的字段类型必须是int64 类型 / string 类型。

fields

field_name

string

显示自定义字段的名称。

field_type

string

显示自定义字段类型,可选值包含 int64、float32、string、bool、list<string>、list<int64>、vector、sparse_vector、text。其中,如果携带 绑定 pipeline 的 text 字段,不允许再携带 vector 或 sparse_vector 字段。

default_val

和field_type一致

显示自定义字段默认值。

dim

int

显示自定义字段向量维度。

pipeline_name

纯文本。

stat

data_number

int

数据量条数。

  • 非实时统计,实时性和数据量有关,数据量越小,实时性越高。
  • 数据写入并创建索引后才会统计。

index_names

array

显示 Collection 相关联的索引名字列表。

index_num

int

显示 Collection 相关联的索引个数。

create_time

string

数据集创建时间。

update_time

string

数据集更新时间。

update_person

string

数据集更新人。

状态码说明

状态码

http状态码

返回信息

状态码说明

0

200

get collection success

查询指定 Collection 的详情成功。

1000005

404

collection not exist

Collection 不存在。

1000003

400

invalid request:%s

非法参数:

  • 缺失必选参数。

1000001

401

unauthorized

请求头中缺乏鉴权信息。

1000002

403

no permission

权限不足。

完整示例

请求消息

curl -i -X GET \
  -H 'Content-Type: application/json' \
  -H 'Authorization: HMAC-SHA256 ***' \
  http://***/api/collection/info \
  -d '{
    "collection_name": "test_name",
}'

响应消息

执行成功返回:

HTTP/1.1 200 OK
Content-Length: 43
Content-Type: application/json
 
{
    "code":0,
    "message":"success",
    "request_id":"021695029537650fd001de666660000000000000000000230da93",
    "data": {
        "collection_name": "test_name",
        "description": "test dataset",
        "primary_key": "id", 
        "fields": [                               
            {
                "field_name": "id",       
                "field_type": "int64"
            },
            {
                "field_name": "text",                     
                "field_type": "string", 
                "default_val": ""
            },
            {
                "field_name": "vector_field",
                "field_type": "dense_vector",      
                "dim": 768
            },
            {
                "field_name": "sparse_vector_field",
                "field_type": "sparse_vector"
            },
            {
                "field_name": "time",
                "field_type": "int64",       
                "default_val": 0
            },
            {
                "field_name": "author",
                "field_type": "string",      
                "default_val": "null"
            }
        ]
        "index_names": [
            "test_index",
            "test_index_1"
        ],
        "index_num": 2,
        "stat":{"data_number":20,"data_storage":2440}
        "create_time": "2023-11-21 12:22:57",
        "update_time": "2023-11-22 11:15:45",
        "update_person": "zhangsan"        
    }
}

执行失败返回:

HTTP/1.1 404 OK
Content-Length: 43
Content-Type: application/json
 
{"code":1000005, "msg":"collection not exist", "request_id":"021695029537650fd001de666660000000000000000000230da93"}