2017-01-03 115 views
2

我正在苦于GAE留言板演示应用程序。我没有做任何修改。我得到了它在本地运行,但是当我部署它,我得到以下错误:GAE数据存储索引未创建

com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found. recommended index is: 
- kind: Greeting 
    ancestor: yes 
    properties: 
    - name: date 
    direction: desc 

The suggested index for this query is: 
    <datastore-index kind="Greeting" ancestor="true" source="manual"> 
     <property name="date" direction="desc"/> 
    </datastore-index> 

在本地运行,目标/生成数据存储的索引,auto.xml - 快照/ WEB-INF/appengine生成的目录。此文件包含完全所需的索引说明:

<datastore-indexes> 
    <!-- Used 1 time in query history --> 
    <datastore-index kind="Greeting" ancestor="true"> 
    <property name="date" direction="desc" /> 
    </datastore-index> 
</datastore-indexes> 

但是,该应用程序抛出错误高于任何地方。

我也尝试将它从自动生成的xml文件移动到手动xml(datastore-indexes.xml)文件。

当我通过mvn -e appengine:deploy部署我没有得到任何错误或警告:

... 
[INFO] GCLOUD: Jan 02, 2017 8:01:14 PM com.google.apphosting.utils.config.IndexesXmlReader readConfigXml 
[INFO] GCLOUD: INFO: Successfully processed /Users/stephanhofmann/Projects/mvntestapp/target/mvntestapp-1.0-SNAPSHOT/WEB-INF/datastore-indexes.xml 
[INFO] GCLOUD: Jan 02, 2017 8:01:14 PM com.google.apphosting.utils.config.IndexesXmlReader readConfigXml 
[INFO] GCLOUD: INFO: Successfully processed /Users/stephanhofmann/Projects/mvntestapp/target/mvntestapp-1.0-SNAPSHOT/WEB-INF/appengine-generated/datastore-indexes-auto.xml 
... 

不管怎么说,谷歌的开发者控制台不显示任何“复合”索引时,我在数据存储>指标检查。我等了超过30分钟(并且没有数据,因此索引应该很快)。

不知道它是否是一个综合指数,应该显示在这里,但该应用程序缺少索引,我卡住了。

任何帮助,非常感谢。

+0

我有完全相同的问题。你找到解决方案吗? –

+0

这里同样的问题。有没有人有办法解决吗? – DFB

+0

我设法解决了这个问题,并在下面发布了我的解决方案。 – DFB

回答

0

运行: gcloud应用部署/Users/stephanhofmann/Projects/mvntestapp/target/mvntestapp-1.0-SNAPSHOT/index.yaml

在终端窗口将定义索引。

1

我在使用mvn appengine:deploy时遇到同样的问题。然后我意识到我必须明确地使用mvn appengine:deployIndex来生成索引。希望能帮助别人。

+0

使用gradle:gradlew appengineDeployIndex为我工作。谢谢 – foolioJones