用户之声——提建议·赢好礼> HOT

功能介绍

/collection/list 接口用于查询指定 Base 类 Database 中所有的 Collection。

接口约束

实例在创建、异常状态下不能执行该操作。

请求示例

注意:
如下示例可直接复制,在 CVM 运行之前,您需在文本编辑器将 api_key=A5VOgsMpGWJhUI0WmUbY******************** 与 10.0.X.X 依据实际情况进行替换。
curl -i -X POST \\
-H 'Content-Type: application/json' \\
-H 'Authorization: Bearer account=root&api_key=A5VOgsMpGWJhUI0WmUbY********************' \\
http://10.0.X.X:80/collection/list \\
-d '{
"database": "db-test"
}'

请求参数

参数
是否必选
参数含义
配置方法
database
设置 Collection 所属的 Database 库名。
使用 /database/list 获取集群中的数据库列表,复制需删除集合所属的数据库名。

响应信息

HTTP 响应消息体是服务器返回给客户端的数据,通常包含了请求的结果或者所请求的资源。/collection/list 接口返回的状态码以及相关信息,如下所示。

状态码

状态码
含义
响应消息
200
执行成功
返回消息体中,以数组的形式列出了数据库中所有的 Collection 信息。具体参数含义,请参见 返回消息参数
400
执行失败
{
"code": 1,
"msg": "operation failed, reason...."
}

返回消息

/collection/list 接口执行成功,将返回数据库中所有的 Collection。返回消息体,如下所示。其每一个参数的含义,请参见 返回参数
{
"code": 0,
"msg": "operation success",
"collections": [
{
"database": "db-test",
"collection": "book-emb",
"documentCount": 4,
"alias": [
"alias-book-emb"
],
"replicaNum": 2,
"shardNum": 1,
"createTime": "2023-09-14 14:48:17",
"embedding": {
"field": "text",
"vectorField": "vector",
"model": "bge-base-zh",
"status": "enabled"
},
"description": "this is the collection description",
"indexes": [
{
"fieldName": "bookName",
"fieldType": "string",
"indexType": "filter"
},
{
"fieldName": "author",
"fieldType": "string",
"indexType": "filter"
},
{
"fieldName": "id",
"fieldType": "string",
"indexType": "primaryKey"
},
{
"fieldName": "vector",
"fieldType": "vector",
"indexType": "HNSW",
"indexedCount": 4,
"dimension": 768,
"metricType": "COSINE",
"params": {
"M": 16,
"efConstruction": 200
}
}
],
"indexStatus": {
"status": "ready",
"startTime": ""
}
},
{
"database": "db-test",
"collection": "book-vector",
"documentCount": 3,
"replicaNum": 2,
"shardNum": 1,
"createTime": "2023-09-14 14:58:04",
"description": "this is the collection description",
"indexes": [
{
"fieldName": "author",
"fieldType": "string",
"indexType": "filter"
},
{
"fieldName": "bookName",
"fieldType": "string",
"indexType": "filter"
},
{
"fieldName": "vector",
"fieldType": "vector",
"indexType": "HNSW",
"indexedCount": 3,
"dimension": 3,
"metricType": "COSINE",
"params": {
"M": 16,
"efConstruction": 200
}
},
{
"fieldName": "id",
"fieldType": "string",
"indexType": "primaryKey"
}
],
"indexStatus": {
"status": "ready",
"startTime": ""
}
}
]
}

返回参数

参数
子参数
子参数
参数含义
database
-
-
显示 Collection 所在的 Database 名称。
collection
-
-
显示 Collection 的名称。
documentCount


Collection 中的 Document 数量。
alias
-
-
Collection 的所有别名。创建名别,请参见 /alias/set
replicaNum
-
-
显示 Collection 的副本数。
shardNum
-
-
显示 Collection 的分片数。
createTime
-
-
显示 Collection 的创建时间。
embedding
Embedding 功能相关参数。
textField
显示 Embedding 模型输入文本的字段名。
vectorField
显示文本被向量化之后存储向量数据的字段名。
model
Embedding 模型的名称。
status
说明该 Collection 是否配置 Embedding 模型。
enabled:已配置。
disabled:未配置。
description
-
-
显示 Collection 的描述信息。
indexes
主键索引
fieldName
标识索引对象为 id
filedType
显示该索引对象的数据类型,固定为 string。
indexType
该参数固定显示为 primaryKey。即该索引对象以 id 为主键构建索引。
向量索引
fieldName
标识索引对象为 vector
filedType
指索引对象为 vector 的数据类型。即该参数固定为 vector
indexType
指定索引对象为 vector 的索引类型。当前所支持的索引类型及具体索引方式,请参见设计模型中的 Index
indexedCount
索引对象为 vector 中包含的文档数。
dimension
显示向量维度。
metricType
显示向量之间的距离度量的算法。
params
显示索引类型对应的参数。
Filter 索引
fieldName
自定义扩展字段,例如:author、bookName。
filedType
显示自定义字段的数据类型。
indexType
显示自定义字段索引类别为filter。在后续检索数据时,才能对该字段设置 Filter 条件表达式进行 混合检索
indexStatus
标识 Collection 是否有重建索引
status
标识当前 Collection 是否在重建索引。
ready:表示当前 Collection 已准备就绪,可正常使用。
training data:表示当前 Collection 正在进行数据训练,即训练模型以生成向量数据。
building index:表示当前 Collection 正在重建索引,即将生成的向量数据存储到新的索引中。
failed:重建索引失败,可能会影响集合读写操作。
startTime
重建索引开始的时间。