Google App Engine error: NeedIndexError: no matching index found
Check https://appengine.google.com/datastore/indexes to see if this index is present and status set to "serving". It's possible that the index is still being built.
The development environment emulates the production environment. It does not really have indexes in the Datastore sense.
I stumbled on the same issue and your comments helped me in the right direction. Here's what Google says how to handle this:
According to the Google documentation the story is that using
gcloud app deploy
the index.yaml file is not uploaded (question is why not?). Anyway, one has to upload this index file manually.
To do so, the documentation gives the following command:
gcloud datastore create-indexes index.yaml
(supposing you execute this from the same directory of the index.yaml file) Once you have done this you can go to the Datastore console and you will see the index has been created. It will then start to be indexed (took some 5 minutes in my case) and once the index is being served you can start your application.
Probably a little late now, but running "gcloud app deploy index.yaml" helped since running deploy by itself ignored the index.yaml file.
As others have said, the dashboard at https://appengine.google.com/datastore/indexes will be showing "pending" for a while.
I fixed this issue by moving the index that the error says is missing above the auto generate line in the "index.yaml" file.
In your case the yaml file will look like:
indexes:
- kind: Bar
ancestor: yes
properties:
- name: rating
direction: desc
# AUTOGENERATED
Then all you have to do is update your app then update the indexes, you update the indexes by running the following command.
appcfg.py [options] update_indexes <directory>
With the directory being the directory relative to your index.yaml file. You should then see that index on your dashboard at https://appengine.google.com/datastore/indexes
The update will initially be "pending" but after the index says "serving" you will be able to make your query.