Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 602
LearningPath Avatar asked Mar 29 '21 23:03

LearningPath


People also ask

What is a composite index firestore?

Composite indexes A composite index stores a sorted mapping of all the documents in a collection, based on an ordered list of fields to index. Note: You can have at most one array field per composite index. Cloud Firestore uses composite indexes to support queries not already supported by single-field indexes.

How do I delete multiple files from firestore cloud?

To delete multiple documents, you can do a single batched write. The WriteBatch class has a delete() method for this purpose. The performance to between a single BatchedWrite and multiple DocumentReference.

What is combined index?

A “composite index”, also known as “concatenated index”, is an index on multiple columns in a table. Many people are wondering, what is more beneficial: Using separate or using composite indexes?


2 Answers

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:

like image 106
dziobaczy Avatar answered Oct 22 '22 02:10

dziobaczy


In the Cloud Firestore UI web panel, the icon with 3 vertical dots is for some reason hidden. If you hover over the right part of the line, just right to the status field, the 3 vertical dots icon will show and hovering over that will show an option to delete the composite index for a collection.

like image 28
Palle M. Pedersen Avatar answered Oct 22 '22 02:10

Palle M. Pedersen