Skip to content

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

@theshivamlko

Description

@theshivamlko

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to documentation

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions