2
votes

I manually removed all data from Google Cloud Datastore using delete button on https://console.cloud.google.com/datastore/entities/query. However, when I checked indexes they are still remaining and there is no delete button on https://console.cloud.google.com/datastore/indexes. I tried to use console command

gcloud datastore cleanup-indexes

But this command does not help.

Are there any way to clean the indexes?

2

2 Answers

5
votes

You can find more details on how the workflow of Datastore indexes should work on the documentation. Specifically, there is an entry explaining how to delete unused indexes and a summary of the workflow of indexes.

In short, in order to force the deletion of indexes (because they are not automatically deleted by default, as they are kept for some time to ensure that performance is not affected), you will first have to update your local index.yaml file, deleting the indexes that you no longer need. Then, you can use the command you shared pointing to the local file, and your indexes should disappear:

gcloud datastore cleanup-indexes /path/to/file/index.yaml
5
votes

gcloud datastore cleanup-indexes /path/to/file/index.yaml

this command no longer works.

gcloud datastore indexes cleanup /path/to/index.yaml

this is the new command.

you should run them in google cloud console. normally you can upload the index.yaml file using file upload feature in google cloud console. your file goes to a directly called _admin you can cd to there and call,

gcloud datastore indexes cleanup index.yaml

Tip

if you are using datastore in a java project, you have datastore-indexes.xml instead of index.yaml. You might have some trouble finding the index.yaml file if you don't know where to look.

you can simply find the path of the index.yaml file by looking at the deploy console in your IDE.