How generate datastore-indexes.xml in Google App engine application (Java)

只愿长相守 提交于 2019-12-11 21:35:04

问题


We have a java application and we deployed this on Google App engine. We created around 150 indexes in datastore and which are running fine in production.

but somehow we missed indexes information in datastore-indexes-auto.xml and there is no any file with name datastore-indexes.xml.

Now we want to have datastore-indexes.xml / datastore-indexes-auto.xml with all existing indexes which serving in production now.

How can we do this? I checked appcfg/gcloud commands, there is no any command to import/download the indexes file from app engine application.

Thanks


回答1:


You could download your deployed app code (How do I download a specific service's source code off of AppEngine?) or check it in StackDriver (similar to Google Cloud DataStore automatic indexing, but looking for the java-specific file(s) instead of index.yaml) and copy/paste the index configs from there.

Place those configs into your app's version-controlled datastore-indexes.xml file (create it if needed) - these will be the manually-maintained indexes. The development server will continue maintain the missing ones automatically in datastore-indexes-auto.xml. The datastore will combine the info from the 2 files at deployment time.

Note that the Datastore indexes are cumulative, they're not automatically deleted if fewer of them are present in newer versions of the xml files, they have to me manually vacuumed/deleted. So check that the index configs recovered with the above method(s) are indeed all of those displayed in the Datastore Indexes page, any missing ones would have to be reconstructed manually from that page info.




回答2:


As of gcloud 211.0.0 you can list your composite indexes with gcloud beta datastore indexes list



来源:https://stackoverflow.com/questions/51673471/how-generate-datastore-indexes-xml-in-google-app-engine-application-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!