I have created a Kind called User in Google App Engine datastore, and I am trying to add an index for this kind.
Firstly, I followed https://cloud.google.com/appengine/docs/standard/java/config/indexconfig to create index by adding datastore-indexes.xml inside war/WEB-INF, but it doesn't work, no index is created after I deploy to app engine.
code in my datastore-indexes.xml:
<?xml version="1.0" encoding="utf-8"?>
<datastore-indexes autoGenerate="false">
<datastore-index kind="User" ancestor="false" source="manual">
<property name="area" direction="asc"/>
<property name="coins_balance" direction="asc"/>
</datastore-index>
</datastore-indexes>
Then I followed https://cloud.google.com/appengine/docs/standard/python/config/indexref, I created an index.yaml and run gcloud app deploy index.yaml
, this time index is actually created.
So can anyone help me understand why datastore-indexes.xml in my case doesn't work, thanks.
appcfg.sh update_indexes path/to/datastore-indexes.xml
? Because if you don't explicitly/manually deploy this file, as you later did, it won't have any effect. - amportgcloud app deploy index.yaml
for the indexes to deploy. - amport