[Docs] Firestore indexing gcloud CLI not working for Embeddings, but Firestore CLI works
Issue
I am using Firestore as DB for storing and retrieving for RAG.
The actual cli give on doc is not working . I tried different fixes with cli none work there always formatting issue.
gcloud firestore indexes composite create --project=gen-lang-client-0291573737 --collection-group=hr_documents --query-scope=COLLECTION --field-config=field-path=__name__,order=ASCENDING --field-config=field-path=embedding,vector-config='{"dimension":768,"flat":{}}' --database="(default)"
Error
ERROR: (gcloud.firestore.indexes.composite.create) Invalid value for [--field-config]: Exactly one of 'order' or 'array-config' must be specified for the fields with the following paths: [__name__ order=ASCENDING, embedding vector-config={"dimension":768,"flat":{}}].
PS C:\Users\Navoki\AndroidStudioProjects\genkit_rag_chromadb_flutter_app_example\genkit_rag_firestore_firebase_function\functions>
Solution
I tried same solution with firebase cli with firestore.indexes.json and it work instantly. Retrieval is working now.
firestore.indexes.json
{
"indexes": [
{
"collectionGroup": "hr_documents",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "__name__",
"order": "ASCENDING"
},
{
"fieldPath": "embedding",
"vectorConfig": {
"dimension": 768,
"flat": {}
}
}
]
}
]
}
Suggestion:
Update Doc here , and add instructions with Firebase CLI too https://genkit.dev/docs/integrations/cloud-firestore/#populate-firestore-with-embeddings
Can i create PR with additional instruction to create Firestore indexes with Firebase CLI
@genkit-bot triage
Triage: stop: not a bug
Area: docs
Root cause: The gcloud firestore indexes composite create snippet in src/content/docs/docs/integrations/cloud-firestore.mdx is valid bash syntax. The reported error occurred because a modified command was run in Windows PowerShell (PS), where unquoted commas in --field-config are parsed as array separators and replaced with spaces (__name__ order=ASCENDING and embedding vector-config=...), preventing gcloud from parsing the order and vector-config keys.
Details
src/content/docs/docs/integrations/cloud-firestore.mdx(lines 220-224 in<Lang lang="js">and lines 537-543 in<Lang lang="go">) marks thegcloudcommand as abashcode block and matches the official Cloud Firestore single-field vector index creation syntax.- In the issue output,
gcloudreported the field paths as[__name__ order=ASCENDING, embedding vector-config={"dimension":768,"flat":{}}]. This happens in Windows PowerShell when,is not quoted: PowerShell splits--field-config=field-path=embedding,vector-config='...'on the comma into a two-element array and passes it togcloudas space-separated tokens insidefield-path. - The command in the issue also includes
--field-config=field-path=__name__,order=ASCENDINGand--database="(default)", which do not come fromcloud-firestore.mdx(nor is__name__needed infirestore.indexes.jsonfor a single-field vector index).
Run f7d12a5f-3d58-40a6-a8cf-ed8c162a3baf · Cloud Run logs