Why am I getting this exception in GAE
I just tested and redeployed my application to a test instance, and it worked fine, then i changed the app id and redeployed to my production instance, and I get an indexing problem. How do I avoid this in the future? I went to the effort to test it first and it worked fine!
Uncaught exception from servlet
com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.. <datastore-index kind="Article" ancestor="false" source="manual">
<property name="tags" direction="asc"/>
<property name="created" direction="asc"/>
</datastore-index>
at com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:40)开发者_StackOverflow中文版
at com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(DatastoreApiHelper.java:67)
The admin console says that it is "Building" the index. It has said that for 20 minutes now! How long does it take!?
When you create new queries, and use them for the first time on your local machine, they always work first time. When you run these new queries for the first time on google app engine, they will return this exception because the google app engine servers take some time to generate an "index" to allow your query to work properly.
I would recommend when you create new queries, to give them a once off run in the production environment to get the "index" built, so that when your users hit them, they work first time.
Secondly,manually pre defining your queries before you need them and uploading them to the server, means that when you really need them they may be built on the server already.
The way I work around this problem is to maintain a number of versions for my app. Typically something like this:
- Version 1: Current Default
- Version 2: Next release
When I have a new release ready for deployment, I upload it to version 2 in this instance. Once the indexes have been built I make version 2 the default. This way customers never experience any downtime or errors.
So in essence you could swap between version 1 and 2 when releasing a new version.
I would suggest that you do also pre-test within a different testing "Application" prior to uploading to your deployed "Application".
This happens because the app-engine Data Store Indexes are not initialized i.e. corydoras's answer is correct. I am adding my fix for java [I presume python and the index.yaml have a similar fix].
You can see which indexes are serving on your using your Google account on https://appengine.google.com/ . click the app link on the left and on the left menu choose Datastore Indexes under data
When one makes a new query to the datastore it can take hours for the data indexes to be updated.
First you should know that debugging in the local environment creates a file called datastore-indexes-auto-xml every time a new "Kind" of entity is stored.
In the local environment it can be used instantly for a query but there is a delay in updating the datastore-indexes-auto-xml.
When deploying an application to the appengine the auto generated datastore-indexes-auto-xml is submitted and the data indexes are updated much faster [to see the results refresh the page].
So
- Make sure none of your Entities have illegal signs e.g. '&'.
- Open the Data Indexes view on appengine.google.com.
- Make sure you havn't deleted the datastore-indexes-auto-xml. [I do this routinely]
- Store an Entity of each "Kind"!
- Use all the "Kinds" in Queries!
- Make sure the datastore-indexes-auto-xml is updated [I sometimes even restart eclipse]
- Deploy to appengine.
- Refresh Data Indexes view on the browser.
- Wait until you see the indexes
- Please tell Google to fix this.
- This was informative but didn't work for me: enter link description here
- This was also informative but didn't work for me: enter link description here
Check your index.yaml file and make sure the proper indices are specified there, etc.
精彩评论