简体   繁体   中英

com.google.appengine.api.datastore.DatastoreNeedIndexException error in Sample App

Im testing a GAE Modules App . My application it is very simple and it has not any query to Cloud SQL or anywhere, it is just a helloworld.

However, I'm getting the f

com.google.appengine.api.datastore.DatastoreNeedIndexException: no mat
    <datastore-index kind="Greeting" ancestor="true" source="manual">
        <property name="date" direction="desc"/>
    </datastore-index>

How could it be possible?

I had developed many times other GAE applications and I have never met with this issue

Queries need to be indexed or else it won't work. In this case it seems like when you are returning the greetings, you sorted them by date. Datastore stores data in pre-sorted tables based on the indexed fields of the entity; which means if you never indexed "date", there doesn't exist a table where all the greetings are sorted by date.

All you need is to add that datastore index block to your datastore-indexes.xml in your WEB-INF folder to fix it.

After adding the index, redeploy and wait about 10 minutes for all your old data to be indexed (it can take longer if you have more data). Try again and it should work now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM