How can I remove unused indexes in Google Application Engine?

Google App-EngineIndexing

Google App-Engine Problem Overview


I've accidentally added a new filter to my GAE application. The status of the index is 'serving' now - however I don't need that index at all and I'd like to remove. How can I do that?

Google App-Engine Solutions


Solution 1 - Google App-Engine

It is documented here. Hope that helps.

> Deleting Unused Indexes > > When you change or remove an index > from index.yaml, the original index is > not deleted from App Engine > automatically. This gives you the > opportunity to leave an older version > of the app running while new indexes > are being built, or to revert to the > older version immediately if a problem > is discovered with a newer version. > > When you are sure that old indexes are > no longer needed, you can delete them > from App Engine using the following > command: > > appcfg.py vacuum_indexes myapp/ > > This command deletes all indexes for the app that are not mentioned in the local version of index.yaml.

Solution 2 - Google App-Engine

For GAE / Java, the documentation includes this information:

> Deleting Unused Indexes > > ... > > When you are sure that old indexes are no longer needed, you can > delete them from App Engine using the vacuum_indexes action: > > ./appengine-java-sdk/bin/appcfg.sh vacuum_indexes myapp/war > > This command deletes all indexes for the app that are not mentioned in > the local versions of datastore-indexes.xml and > generated/datastore-indexes-auto.xml.

Solution 3 - Google App-Engine

As of Feb 2019 it's now:

gcloud datastore indexes cleanup index.yaml

Solution 4 - Google App-Engine

In Windows Google AppEngine Java, we have to use appcfg.cmd command to delete unused indexes of deployed application.

Syntax : > appengine-java-sdk-path\bin\appcfg.cmd vacuum_indexes project-root-path\poject-name\war\

Solution 5 - Google App-Engine

For gae-java, as JochenJung mentioned, the "vacuum_indexes" tool will work, but you'll have to emulate a python project in the following way:

Note that the vacuum tool seems only to work when pointed at *.appspot.com, not the local dev. environment.

  • create app.yaml for your app and put this in your /myapp/ root directory, minimally:


application: myproj
version: 4
runtime: python
api_version: 1

where "version" is your app's version, "myproj" the GAE name of your project.

  • create an index.yaml and put it in the same root dir. Instead of laboriously putting into that file the index information for indices you want to keep, it turns out that the tool is going to give you a yes/no confirmation for each and every index it deletes, so it is simpler just to indicate that ALL indices should be dropped, and use the confirmation to preserve the ones you want to keep.


indexes:



AUTOGENERATED

Then run the command as shown above,


/appcfg.py vacuum_indexes /path/to/myproj/

Solution 6 - Google App-Engine

If you're using maven mvn appengine:vacuum_indexes. No need to mvn appengine:update, the command updates the remote server.

A full list of maven commands here.

Solution 7 - Google App-Engine

On Windows using Java, this command worked for me:

appcfg.cmd vacuum_indexes C:\Users\Name\AndroidStudioProjects\Project\backend\src\main\webapp\

Note: Make sure you have a datastore-indexes.xml in the webapp folder (these indexes will be spared).

Solution 8 - Google App-Engine

With the current version of gcloud, you can simply do:

gcloud datastore cleanup-indexes index.yaml

which is more intuitive than calling appcfg.cmd [...].

Solution 9 - Google App-Engine

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTamas KalmanView Question on Stackoverflow
Solution 1 - Google App-EnginefuentesjrView Answer on Stackoverflow
Solution 2 - Google App-EnginemjnView Answer on Stackoverflow
Solution 3 - Google App-EngineBovardView Answer on Stackoverflow
Solution 4 - Google App-EngineSridhar NalamView Answer on Stackoverflow
Solution 5 - Google App-Enginelarham1View Answer on Stackoverflow
Solution 6 - Google App-EngineMarc M.View Answer on Stackoverflow
Solution 7 - Google App-EngineBooView Answer on Stackoverflow
Solution 8 - Google App-EngineirondwarfView Answer on Stackoverflow
Solution 9 - Google App-EngineSankha KarunasekaraView Answer on Stackoverflow