Rams
Rams

Reputation: 2189

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

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

Upvotes: 0

Views: 640

Answers (2)

Rams
Rams

Reputation: 2189

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

Upvotes: 0

Dan Cornilescu
Dan Cornilescu

Reputation: 39834

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.

Upvotes: 1

Related Questions