Firestore: a compound query does not map to an index
Firestore rejects a compound query with a range clause? That query does not map to an existing index. The error includes a link that creates the missing index.
Reviewed October 22, 2026
What it means in plain English
Cloud Firestore requires an index for every query. Indexes for the most basic queries are created automatically. A compound query with a range clause that does not map to an existing index returns an error. Firebase says that error message includes a direct link to create the missing index in the Firebase console.
Those links open the Firebase console. You can manage Cloud Firestore from the Firebase console or the Google Cloud console.
A rules rejection is a different error. See Firestore: Missing or insufficient permissions.
Likely causes
- The query combines a range clause with other fields, and no index covers that shape.
- The index is still building. Firebase says setup takes a few minutes, including for an empty database.
- The account creating the index does not have a role Firebase lists for that action.
How to fix it, step by step
- Open the link in the error. Review the fields Firebase filled in, then click Create. For a non-array, non-map field, select ascending or descending order even if you do not order by that field. Firebase says that choice does not change how equalities behave.
- If the missing index is a vector index, the error includes a Google Cloud CLI command. Run that command.
- To create the index yourself, open Databases and Storage, then Firestore, then the Indexes tab, click Add Index, enter the collection and the fields to order by, and click Create.
- The account needs
roles/datastore.owner,roles/datastore.indexAdmin,roles/editor, orroles/owner. A custom role needsdatastore.indexes.create,datastore.indexes.delete,datastore.indexes.get,datastore.indexes.list, anddatastore.indexes.update. - Wait for the build. Firebase says an index takes a few minutes at minimum. While it builds, the Composite Indexes section shows a building status bar. If creation fails, the console shows the message. Firebase says the usual cause is an index limit. After you confirm you are not hitting an index limit, run the index operation again.
How to check it worked
- The same compound query no longer returns the missing-index error.
- The new index is listed under Composite Indexes, and the building status bar is gone.
Sources
Related fixes
More Firebase fixes
Keep going on your own.
The guides stay free. A deep leak report is $15. Fix packs are $24, or $49 for all three. There is no done-for-you repair.