genkit icon indicating copy to clipboard operation
genkit copied to clipboard

[Docs] Firestore indexing gcloud CLI not working for Embeddings, but Firestore CLI works

Open theshivamlko opened this issue 1 year ago • 2 comments

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

theshivamlko avatar Nov 27 '25 12:11 theshivamlko

@genkit-bot triage

ssbushi avatar Nov 20 '26 17:11 ssbushi

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 the gcloud command as a bash code block and matches the official Cloud Firestore single-field vector index creation syntax.
  • In the issue output, gcloud reported 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 to gcloud as space-separated tokens inside field-path.
  • The command in the issue also includes --field-config=field-path=__name__,order=ASCENDING and --database="(default)", which do not come from cloud-firestore.mdx (nor is __name__ needed in firestore.indexes.json for a single-field vector index).

Run f7d12a5f-3d58-40a6-a8cf-ed8c162a3baf · Cloud Run logs

genkit-bot avatar Nov 20 '26 17:11 genkit-bot