Search code examples
fluttergoogle-cloud-firestorefirebase-consoledatabase-indexes

How to delete composite indexes in Cloud Firestore?


The documentation says : https://firebase.google.com/docs/firestore/query-data/indexing

To delete an index:

Go to the Cloud Firestore section of the Firebase console.
Click the Indexes tab.
Hover over the index you want to delete and select Delete from the context menu.
Confirm that you want to delete it by clicking Delete from the alert.

On current Cloud Firestore ,

  • Single field index can be deleted by using right submenu
  • But hovering doest work and submenu are inexistent for composite index section

I have only found a console command to delete all indexed for a firestore db


Solution

  • I have same issue with firestore UI web panel tho I found a solution using cloud.

    First you need to enter https://console.cloud.google.com/ and select your project after that open gcloud terminal (you can access this on the top right corner nearby your avatar).

    enter image description here

    To list all your composite indexes for selected project, type this into the terminal

    gcloud firestore indexes composite list
    

    Then pick id of the one you want to remove and type

    gcloud firestore indexes composite delete <composite-id>
    

    It'll ask you for confirmation, once you done it by typing and entering y your index is gone c: