Deploy Firestore Indexes

16. Deploy Firestore Indexes

Firestore needs a composite index for every query that filters and sorts on more than one field. Foodie uses many of these (nearby restaurants, order lists, reports), so deploy the supplied index definitions before going live — otherwise those screens fail with “The query
requires an index”.

16.1. Install Node.js — see Installing Node.js & npm.

16.2. Unzip the source file named “Firebase Indexing.zip”.

16.3. Open a terminal in the extracted folder (Ctrl+Shift + right-click → “Open PowerShell window here” on Windows).

16.4. Log in to Firebase, if you have not already:

firebase login

16.5. Initialise Firestore configuration in the folder:

firebase init

16.6. Confirm with Y and press Enter.

16.7. Choose Firestore: Configure security rules and index files for Firestore.

Important Notes:

Use the arrow keys to move between options and the space bar to select one, then press Enter to confirm.

16.8. Choose Use an existing project.

16.9. Select your Foodie project.

16.10. Press Enter to accept the default rules file name (firestore.rules).

16.11. Press Enter to accept the default index file name (firestore.indexes.json).

16.12. Open the generated firestore.indexes.json, delete its contents, and paste in everything from the supplied firestore_indexes.json file.

16.13. Deploy the indexes:

firebase deploy --only firestore:indexes

Building the indexes takes a few minutes. Watch the progress in Firebase Console → Firestore Database → Indexes and wait until every index shows Enabled.

See Video

Recent Posts

    Archives

    No archives to show.

    Categories

    • No categories

    Blog Categories

    • No categories

    Archives

      Categories

      • No categories