I’m trying to create a single-field vector index in my Firestore database using the gcloud command-line interface (CLI) to enable vector search functionality. However, I keep getting this error:
However, I keep getting this error:
ERROR: (gcloud.alpha.firestore.indexes.composite.create) Invalid value for [–field-config]: Composite indexes must be configured with at least 2 fields. For single-field index management, use the commands under
gcloud firestore indexes fields
.
This is the command I’m running, based on the official documentation and what is returned when I try to query the collection:
gcloud alpha firestore indexes composite create --collection-group=People --query-scope=COLLECTION --field-config field-path="embedding",vector-config='{"dimension":"768", "flat": "{}"}'
I’ve confirmed that:
- The embedding field exists in my Firestore documents.
- I have the necessary permissions to create indexes.
- I’m using the latest version of the gcloud CLI.
What am I doing wrong? How can I successfully create a single-field vector index in Firestore using the gcloud CLI?