I found that if I used my query a few times on the development server then your above code snippet was automatically inserted in my index.yaml - neat! (not app.yaml) Then when I uploaded to Google App Engine I got errors for a few minutes while the index was building, but eventually it worked.