WANG
WANG

Reputation: 15

datastore-indexes.xml doesn't work, creates no index after deploy

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.

Upvotes: 0

Views: 266

Answers (1)

Jim Morrison
Jim Morrison

Reputation: 2897

As documented in the java index config page and noted in the comments, datastore-indexes.xml is only supported through appcfg.sh at this time. To use gcloud, you'll need to configure your indexes as a yaml file.

Upvotes: 3

Related Questions