Google App Engine错误:NeedIndexError:找不到匹配的索引 [英] Google App Engine error: NeedIndexError: no matching index found

查看:139
本文介绍了Google App Engine错误:NeedIndexError:找不到匹配的索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Google的App引擎索引时遇到问题。当通过GoogleAppEngineLauncher运行我的应用时,该应用工作正常。在部署应用程序时,出现以下错误:

I'm having trouble with Google's App engine indexes. When running my app via the GoogleAppEngineLauncher, the app is working fine. When deploying the app, I get the following error:

NeedIndexError: no matching index found.
The suggested index for this query is:
- kind: Bar
  ancestor: yes
  properties:
  - name: rating
    direction: desc

这行代码后会产生错误:

The error is generated after this line of code:

 bars = bar_query.fetch(10)

上面的代码行,它读取:

Before the above line of code, it reads:

bar_query = Bar.query(ancestor=guestbook_key(guestbook_name)).order(-Bar.rating)

我的index.yaml文件包含下面的确切建议索引#AUTOGENERATED:

My index.yaml file contains the exact "suggested" index below # AUTOGENERATED:

- kind: Bar
  ancestor: yes
  properties:
  - name: rating
    direction: desc

我可能错过了什么吗?我删除了index.yaml文件并再次部署应用程序(通过命令行),并且少了一个文件被上传 - 所以index.yaml文件就在那里。

Am I maybe missing something? I removed the index.yaml file and deployed the app again (via the command-line) and one less file was uploaded - so the index.yaml file is there.

一切都在本地正常工作。我正在研究最新的Mac OSx。用于部署的命令为:

Everything is working fine locally. I'm working on the latest Mac OSx. The command used for deployment was:

appcfg.py -A app-name --oauth2 update app

我实现的数据存储松散地基于留言板教程应用程序。

The datastore I implemented is loosely based on the guestbook tutorial app.

任何帮助将不胜感激。

编辑:

我的ndb.Model定义如下:

My ndb.Model is defined as follow:

class Bar(ndb.Model):
    content = ndb.StringProperty(indexed=False)
    lat = ndb.FloatProperty(indexed=False)
    lon = ndb.FloatProperty(indexed=False)
    rating = ndb.IntegerProperty(indexed=True)
    url = ndb.TextProperty(indexed=False)


推荐答案

检查https://appengine.google.com/datastore/indexes 查看此索引是否存在,并将状态设置为正在投放。有可能索引仍在构建中。

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.

这篇关于Google App Engine错误:NeedIndexError:找不到匹配的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆