我已经在Google App Engine数据存储区中创建了一个名为User的种类,并且我正在尝试为此类型添加索引。
首先,我跟随https://cloud.google.com/appengine/docs/standard/java/config/indexconfig通过在war / WEB-INF内添加datastore-indexes.xml来创建索引,但这是行不通的,部署到应用程序引擎后没有创建索引。
我的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>
然后我跟随https://cloud.google.com/appengine/docs/standard/python/config/indexref,创建了一个index.yaml并运行gcloud app deploy index.yaml
,这次实际上是创建索引了。
那么任何人都可以帮助我理解为什么在我的情况下datastore-indexes.xml不起作用,谢谢。
答案 0 :(得分:3)
如java index config页中所记录并在注释中指出的那样,目前仅通过appcfg.sh支持datastore-indexes.xml。要使用gcloud,您需要将索引配置为yaml文件。