我正在尝试使用 gcloud 命令行界面 (CLI) 在 Firestore 数据库中创建单字段向量索引以启用向量搜索功能。
但是,我不断收到此错误:
错误:(gcloud.alpha.firestore.indexes.composite.create)[--field-config] 值无效:复合索引必须配置至少 2 个字段。对于单字段索引管理,请使用
下的命令。gcloud firestore indexes fields
这是我正在运行的命令,基于官方文档以及我尝试查询集合时返回的内容:
gcloud alpha firestore indexes composite create --collection-group=People --query-scope=COLLECTION --field-config field-path="embedding",vector-config='{"dimension":"768", "flat": "{}"}'
我已确认:
我知道此功能仍处于 alpha 阶段,但我认为文档已损坏,因为它使用复合命令创建单个字段索引。
如何使用 gcloud CLI 在 Firestore 中创建单字段向量索引?