功能介绍
/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 库名。 |
响应信息
HTTP 响应消息体是服务器返回给客户端的数据,通常包含了请求的结果或者所请求的资源。/collection/list 接口返回的状态码以及相关信息,如下所示。
状态码
状态码 | 含义 | 响应消息 |
200 | 执行成功 | |
400 | 执行失败 |
|
返回消息
{"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 | - | - | |
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 | |
| | indexedCount | 索引对象为 vector 中包含的文档数。 |
| | dimension | 显示向量维度。 |
| | metricType | 显示向量之间的距离度量的算法。 |
| | params | 显示索引类型对应的参数。 |
| Filter 索引 | fieldName | 自定义扩展字段,例如:author、bookName。 |
| | filedType | 显示自定义字段的数据类型。 |
| | indexType | |
indexStatus
| 标识 Collection 是否有重建索引 | status | 标识当前 Collection 是否在重建索引。 ready:表示当前 Collection 已准备就绪,可正常使用。 training data:表示当前 Collection 正在进行数据训练,即训练模型以生成向量数据。 building index:表示当前 Collection 正在重建索引,即将生成的向量数据存储到新的索引中。 failed:重建索引失败,可能会影响集合读写操作。 |
| |
startTime
| 重建索引开始的时间。 |