How can I remove unused indexes in Google Application Engine?
up vote
51
down vote
favorite
16
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 indexing
shareimprove this question
asked May 2 '09 at 0:45
Tamas Kalman
9411820
add a comment
6 Answers
activeoldestvotes
up vote
78
down vote
accepted
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.
shareimprove this answer
edited Mar 16 '12 at 14:56
Jesse Rusak
39.9k107284
answered May 2 '09 at 1:02
fuentesjr
13.8k195669
1
@fuentesjr: I took the liberty of adding the quoted text/code to your post. – Mitch Wheat May 2 '09 at 1:09
1
This seams to work for the Python version only :-( When using the JavaSDK the vacuum_indexes parameter is missing. It's also no use using the appcfg.py command, for Java does not store the indexes in index.yaml Which means you would have to create this file yourself and try to type all the indexes within the way you defined them in Javas xml. – JochenJung Nov 23 '10 at 12:59
If I remove an index from index.yaml will GAE continue to create this index or I have to delete it with the mentioned process? – PanosJee Oct 11 '12 at 4:44
add a comment
up vote
23
down vote
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.
shareimprove this answer
answered Jul 27 '11 at 17:39
mjn
21.9k12106258
2
WARNING: For me, it only seemed to take datastore-indexes-auto.xml into consideration. This meant it offered to delete indexes that were mentioned in datastore-indexes.xml claiming they were no longer used (when they were). Apart from that though, it worked for me in deleting my error indexes and I didn't have to create any yaml files like other answers suggest. – matt burns Nov 6 '11 at 13:57
add a comment
up vote
4
down vote
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/
shareimprove this answer
answered Dec 16 '10 at 6:27
larham1
3,69622022
1
I'm using Java GAE. This worked like a charm. However, I did have to update the app.yaml to something like: application: myproj version: 4 runtime: python api_version: 1 handlers: -url: / script: home.py since I was getting an error No UrlMap entires found in application configuration when running vaccum_indexes. Also, just to make it clear, both the app.yaml and index.yaml file should go inside your war/WEB-INF folder. Then the command to run, as an example, would be: appcfg.py vacuum_indexes /path/to/myproj/WEB-INF – Stewie Jun 24 '11 at 13:45
add a comment
up vote
3
down vote
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\
shareimprove this answer
edited Oct 16 '13 at 17:23
answered Oct 8 '13 at 14:02
NovelGuy
19225
add a comment
up vote
0
down vote
On Windows this command worked for me, make sure you have a datastore-indexes.xml in the webapp folder (these indexes will be sparred):
appcfg.cmd vacuum_indexes C:\Users\Name\AndroidStudioProjects\Project\backend\src \main\webapp\
shareimprove this answer
answered Jul 12 at 19:35
Boo
6017
add a comment
up vote
0
down vote
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.
shareimprove this answer