接口定义
describe_collection() 接口用于查询指定 Collection 的信息。
def describe_collection(self, name: str, timeout: Optional[float] = None) -> Collection
使用示例
db = client.database('db-test')# 查询 Base 类数据库下的集合res = db.describe_collection('book-emb')print(vars(res))
入参描述
参数名 | 是否必选 | 参数含义 | 配置方法 |
name | 是 | 指定所需查询的 Collection 名称。 | Collection 命名要求如下: 只能使用英文字母,数字,下划线_、中划线-,并以英文字母开头。 长度要求:[1,128]。 |
timeout | 否 | 请求超时时长。 | 单位:秒。 默认值:VectorDBClient() 接口配置的 timeout 时长。 取值范围:大于等于0。 |
出参描述
{"database": "db-test","collection": "book-emb","replicaNum": 2,"shardNum": 1,"description": "this is a collection of test embedding","indexes": [{"fieldName": "id","fieldType": "string","indexType": "primaryKey"},{"fieldName": "author","fieldType": "string","indexType": "filter"},{"fieldName": "vector","fieldType": "vector","indexType": "HNSW","dimension": 768,"metricType": "COSINE","params": {"M": 16,"efConstruction": 200},"indexedCount": 3},{"fieldName": "bookName","fieldType": "string","indexType": "filter"},{"fieldName": "tags","fieldType": "string","indexType": "filter"}],"embedding": {"status": "enabled","field": "text","model": "bge-base-zh","vectorField": "vector"},"documentCount": 3,"alias": ["alias-book-emb"],"indexStatus": {"status": "ready","startTime": ""}}
参数 | 子参数 | 子参数 | 参数含义 |
database | - | - | 显示 Collection 所在的 Database 名称。 |
collection | - | - | 显示 Collection 的名称。 |
replicaNum | - | - | 显示 Collection 的副本数。 |
shardNum | - | - | 显示 Collection 的分片数。 |
createTime | - | - | 显示 Collection 的创建时间。 |
description | - | - | 显示 Collection 的描述信息。 |
documentCount | - | - | 返回 Collection 中存储的 Document 数量。 |
indexes | 主键索引 | fieldName | 标识索引对象为 id。 |
| | filedType | 显示该索引对象的数据类型,固定为 string。 |
| | indexType | 该参数固定显示为 primaryKey。即该索引对象以 id 为主键构建索引。 |
| 向量索引 | fieldName | 标识索引对象为 vector 字段名,固定为 vector。 |
| | filedType | 指定索引对象为 vector 字段的数据类型,固定为 vector。 |
| | indexType | |
| | indexedCount | 索引对象为 vector 字段的文档数量。 |
| | dimension | 显示索引对象为 vector 的向量维度。 |
| | metricType | 显示索引象为 vector 的向量之间的距离度量的算法。 |
| | params | 显示索引类型对应的参数。 |
| Filter 索引 | fieldName | 自定义扩展的可设置 Filter 表达式的字段名。例如:page、author。 |
| | filedType | 显示字段的数据类型。 |
| | indexType | |
embedding | Embedding 相关参数 | status | 说明该 Collection 是否配置 Embedding 模型。 enabled:已配置。 disabled:未配置。 |
| | field | 显示 Embedding 模型输入文本的字段名。 |
| | model | Embedding 模型的名称。 |
| | vectorField | 显示 Embedding 模型向量字段名。 |
alias | 集合别名 | - | 集合别名。 |
indexStatus | 集合重建索引相关参数 | status | 标识当前 Collection 是否在重建索引。 ready:表示当前 Collection 已准备就绪,可正常使用。 training:表示当前 Collection 正在进行数据训练,即训练模型以生成向量数据。 building:表示当前 Collection 正在重建索引,即将生成的向量数据存储到新的索引中。 failed:重建索引失败,可能会影响集合读写操作。 |
| | startTime | 重建索引开始的时间。 |