Indexes

View, create, and manage Firestore composite indexes and field overrides.

Overview

Firestore requires composite indexes for queries that filter or sort on multiple fields. The Indexes view in Stackpane lets you manage these indexes directly without using the Firebase Console or CLI.

Prerequisites

Stackpane uses the Cloud Firestore API to manage indexes — the same API used for Firestore document browsing. It must be enabled in your Google Cloud project.

gcloud services enable firestore.googleapis.com --project YOUR_PROJECT_ID
  • Required IAM role: Cloud Datastore User (roles/datastore.user) for creating and managing indexes
  • Cost notes: No additional cost for managing indexes. Index storage counts toward your Firestore storage quota.

Viewing Indexes

Navigate to Firestore Indexes from the sidebar. Composite indexes and field overrides load automatically.

The index table shows:

  • Collection Group — the collection the index applies to
  • Fields — field paths with their sort order (Ascending, Descending) or Array Contains configuration
  • Query Scope — Collection (single collection) or Collection Group (across subcollections)
  • State — the current index build status

Index States

  • CREATING — the index is being built (may take minutes to hours for large collections)
  • READY — the index is active and serving queries
  • NEEDS_REPAIR — the index encountered an error and needs to be recreated

Building indexes are polled for status updates so you can monitor progress.

Creating Composite Indexes

  1. Click Create Index in the toolbar.
  2. Enter the collection group ID (the collection name).
  3. Select the query scope: Collection or Collection Group.
  4. Add at least two fields:
    • Enter the field path
    • Select the order: Ascending, Descending, or Array Contains
  5. Click + to add more fields, or the trash icon to remove one.
  6. Click Create to submit the index for building.

The new index appears in the table with a CREATING state and transitions to READY when the build completes.

Field Overrides (Exemptions)

Field overrides customize the default indexing behavior for specific fields:

  1. Scroll to the Field Overrides section below composite indexes.
  2. Click Create Override to add a new override.
  3. Enter the collection group ID and field path.
  4. Configure the desired index entries (ascending, descending, array contains) with query scope.
  5. Delete overrides via the context menu.

Overrides are useful for opting large fields out of automatic indexing or enabling array-contains indexes on specific fields.

Exporting Indexes

Export your index configuration as a JSON file compatible with firestore.indexes.json:

  1. Click the Export button in the toolbar.
  2. Save the JSON file.

This is useful for version-controlling your index configuration alongside your codebase and deploying indexes via the Firebase CLI.

Index Recommendations

Stackpane analyzes query patterns from the query builder and saved queries to suggest composite indexes that would improve performance. Check the recommendations section for suggestions on indexes that could optimize your most common queries.

Tips

  • Create indexes proactively for queries you know your application uses
  • Monitor CREATING indexes — large collections may take time to build
  • Export your index configuration to version control for reproducible deployments
  • Use field overrides sparingly to avoid unexpected indexing behavior
  • If an index is stuck in CREATING, try deleting and recreating it