2017-01-03 118 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