Reputation: 66390
We have introduced a new model to our Datastore a few days ago. Surprisingly I still get Index warnings
W 2014-02-09 03:38:28.480
suspended generator run_to_queue(query.py:938) raised NeedIndexError(no matching index found.
The suggested index for this query is:
- kind: FeelTrackerRecord
ancestor: yes
properties:
- name: timestamp)
W 2014-02-09 03:38:28.480
suspended generator helper(context.py:814) raised NeedIndexError(no matching index found.
The suggested index for this query is:
- kind: FeelTrackerRecord
ancestor: yes
properties:
- name: timestamp)
even though the index is served under DataStore Indexes
indexes:
# AUTOGENERATED
# This index.yaml is automatically updated whenever the dev_appserver
# detects that a new type of query is run. If you want to manage the
# index.yaml file manually, remove the above marker line (the line
# saying "# AUTOGENERATED"). If you want to manage some indexes
# manually, move them above the marker line. The index.yaml file is
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.
- kind: FeelTrackerRecord
ancestor: yes
properties:
- name: record_date
- name: timestamp
What am I missing please?
Upvotes: 2
Views: 3020
Reputation: 12986
I mentioned in a comment your indexes don't match the required. The error says
raised NeedIndexError(no matching index found.
The suggested index for this query is:
- kind: FeelTrackerRecord
ancestor: yes
properties:
- name: timestamp)
However you the index you list is different
- kind: FeelTrackerRecord
ancestor: yes
properties:
- name: record_date
- name: timestamp
Do you see the difference ?
Just add the index as listed and update your indexes.
Upvotes: 0
Reputation: 66390
I finally found the problem.
Best way to solve this is to make sure the local index.yaml
is empty (delete all the indices). Then simply run your GAE app on localhost and access your app as you would expect.
Http access is pretty straightforward over browser and if GET/POST over REST is required you can use curl
from a terminal:
GET:
curl --user [email protected]:test123 http://localhost:8080/api/v1.0/records/1391944029
POST:
curl --user [email protected]:test123 http://localhost:8080/api/v1.0/records/1391944029 -d '{"records": [
{
"notes": "update",
"record_date": "2014-02-02",
"timestamp": 1391944929
}
], "server_sync_timestamp": null}' -X POST -v -H "Accept: application/json" -H "Content-type: application/json"
GAE is now updating the index.yaml
automatically and add the correct indices in there.
After your deploying your app, you need to cleanup the old indices. This is done through a terminal:
appcfg.py vacuum_indexes src
After login with credentials it will ask you about the old indices that are no longer in your index.yaml
and if they should be deleted. Press y and continue.
Upvotes: 3