You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用gcloud CLI创建Firestore单字段向量索引遇报错,求解决方法

解决Firestore单字段向量索引创建的gcloud CLI命令问题

正确命令

创建单字段向量索引需使用gcloud firestore indexes fields update命令,而非复合索引创建命令,具体执行命令如下:

gcloud firestore indexes fields update "embedding" \
  --collection-group=People \
  --vector-config='{"dimension":768, "flat": {}}'

错误原因解释

你之前使用的gcloud alpha firestore indexes composite create是用于创建复合索引的命令,这类索引强制要求至少包含2个字段,这就是触发错误提示的核心原因。单字段向量索引属于单字段索引范畴,必须使用gcloud firestore indexes fields下的命令进行管理,错误提示中也明确指明了这一点。

已验证条件确认

你已确认的以下条件均满足,无需额外排查:

  • Firestore文档中存在embedding字段
  • 拥有创建索引的必要权限
  • 使用最新版本的gcloud CLI

内容的提问来源于stack exchange,提问作者capiono

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 13:46:05