Composite indexes#
Composite indexes exist only for the platform-owned collections — the collection groups below, shared by every project. Store collections never get one: a listing that filters and sorts runs on a query key instead. The file is deployed per core project (Production and Demo) and reaches a Space cloud on its next Re-check.
__name__ implicit, appended by Firestore| Collection group | Fields, in index order | Query scope |
|---|---|---|
backups1 index | kindcreated__name__ | collection |
log3 indexes | statusduration__name__ | collection |
statustimestamp__name__ | collection | |
statustimestamp__name__ | collection | |
logs1 index | levelat__name__ | collection |
orders6 indexes | __name__ | collection |
payment.servicestatus__name__ | collection | |
shipping.servicestatus__name__ | collection | |
statustimestamp__name__ | collection | |
statustimestampinvoice.total__name__ | collection | |
statustimestamp__name__ | collection | |
products17 indexes | __name__ | collection |
categoriesname__name__ | collection | |
categoriesprice.price__name__ | collection | |
categoriesprice.price__name__ | collection | |
categoriestimestamp__name__ | collection | |
statuscategoriesname__name__ | collection | |
statuscategoriesprice.price__name__ | collection | |
statuscategoriesprice.price__name__ | collection | |
statuscategoriestimestamp__name__ | collection | |
statustagsname__name__ | collection | |
statustagsprice.price__name__ | collection | |
statustagsprice.price__name__ | collection | |
statustagstimestamp__name__ | collection | |
tagsname__name__ | collection | |
tagsprice.price__name__ | collection | |
tagsprice.price__name__ | collection | |
tagstimestamp__name__ | collection | |
records1 index | statustimestamp__name__ | collection |
stock4 indexes | __name__ | collection |
ownersupply__name__ | collection | |
ownersupply__name__ | collection | |
storessupply__name__ | collection |
Built-in query keys#
A key serves == on its leading fields and a range or sort (either direction) on the last one, marked . The platform maintains a computed _k.{name} field per document and rewrites a matching query onto it, so none of these needs a composite index.
Content collections#
Derived from the collection's schema template in schema order ("first" = first in the schema), up to 5 per collection on their own budget. Number, boolean and array fields derive nothing.
| Built-in key | Fields | Rule | Worked example |
|---|---|---|---|
status_timestamp | statustimestamp | every collection, with or without a template — "published, newest first" | recipes → status_timestamp |
status_{date} | status{date} | one key per datetime field, for the first two — "published articles by publish_date", date ranges | articles with publish_date → adds status_publish_date |
{enum}_{date} | {enum}{date} | the first enum field; the date is the first datetime field, else timestamp — "category X, newest first" | recipes with an enum category, no date → category_timestamp |
status_{enum}_{date} | status{enum}{date} | the same, published only | recipes → status_category_timestamp |
So recipes (an enum category, no date field) gets status_timestamp, category_timestamp, status_category_timestamp; articles with a publish_date gets status_timestamp, status_publish_date.
Products mirror#
The per-locale data/{locale}/products mirror — what a storefront lists — has a fixed set. Its category and tag pages (an array filter with a sort) run on the products composites above instead; one array filter per query.
| Key | Fields |
|---|---|
status_price | statusprice.price |
status_name | statusname |
status_timestamp | statustimestamp |
Declared keys#
Beyond the built-ins a collection declares up to 8 keys of its own (keys: {"<name>": ["<field>", …]}, 1–4 fields each) on the collection row; null under a built-in's name disables that built-in, a list under the same name replaces it. Shape, limits and the query_key_required answer: API overview › Query keys.
Generated from firestore.indexes.json and PRODUCT_QUERY_KEYS at build — 33 composite indexes, 3 built-in product keys.