Python 412未找到匹配索引错误
我有以下错误: 412未找到匹配的索引。建议的索引是:Python 412未找到匹配索引错误,python,google-cloud-datastore,google-cloud-platform,Python,Google Cloud Datastore,Google Cloud Platform,我有以下错误: 412未找到匹配的索引。建议的索引是:种类:月报属性:名称:属于名称:添加日期 我使用的是Python 3.5、数据存储和一个远程Django项目,该项目通过google cloud API(google cloud==0.24.0)访问数据存储 我运行命令: google cloud datastore cleanup-indexes index.yaml google cloud datastore create-indexes index.yaml 将创建索引: inde
种类:月报
属性:
名称:属于
名称:添加日期
我使用的是Python 3.5、数据存储和一个远程Django项目,该项目通过google cloud API(google cloud==0.24.0)访问数据存储 我运行命令:
google cloud datastore cleanup-indexes index.yaml
google cloud datastore create-indexes index.yaml
将创建索引:
index.yaml:
indexes:
- kind: history
ancestor: no
properties:
- name: date_added
direction: asc
- name: address
direction: asc
- kind: payment
ancestor: no
properties:
- name: date_added
direction: asc
- name: belongs_to
- name: order
- kind: monthly_report
ancestor: no
properties:
- name: date_added
direction: asc
- name: status
- name: belongs_to
direction: asc
我对种类付款
进行查询,并在日期添加过滤器
和所属过滤器
。它起作用了
但是,在相同的方法中,我使用添加了的日期和所属的上的过滤器对种类月报
进行了查询,得到了上面的错误
问题是什么
更新:
indexes:
- kind: history
ancestor: no
properties:
- name: date_added
direction: asc
- name: address
direction: asc
- kind: payment
ancestor: no
properties:
- name: date_added
direction: asc
- name: belongs_to
- name: order
- kind: monthly_report
ancestor: no
properties:
- name: date_added
direction: asc
- name: status
- name: belongs_to
direction: asc
如果我过滤一个名字,它就可以工作,而过滤多个名字就不能工作。每当你进行一个涉及你使用的所有过滤器的查询时,谷歌应用引擎的数据存储就会自动创建索引。它将您的表数据存储在该索引中,以便快速提供服务。因此,无论何时部署,都必须更新新索引
如果您使用appcfg进行部署,
appcfg.py-更新索引。
这里的
是index.yaml
文件的路径
每当您没有找到匹配的索引或NeedIndexError
或缺少索引错误时,该错误也会提示缺少哪个索引。因此,您只需将建议的索引放入index.yaml
文件中,并使用上述命令更新索引
在这种情况下,将缺少的索引添加到index.yaml
文件中
- kind: monthly_report
properties:
- name: belongs_to
- name: date_added
我希望这有帮助。有关详细信息每当您进行涉及所用过滤器的查询时,Google app engine的数据存储将自动创建索引。它将您的表数据存储在该索引中,以便快速提供服务。因此,无论何时部署,都必须更新新索引
如果您使用appcfg进行部署,
appcfg.py-更新索引。
这里的
是index.yaml
文件的路径
每当您没有找到匹配的索引或NeedIndexError
或缺少索引错误时,该错误也会提示缺少哪个索引。因此,您只需将建议的索引放入index.yaml
文件中,并使用上述命令更新索引
在这种情况下,将缺少的索引添加到index.yaml
文件中
- kind: monthly_report
properties:
- name: belongs_to
- name: date_added
我希望这有帮助。有关更多信息订单似乎很重要,因此我更改了以下内容:
- kind: monthly_report
properties:
- name: belongs_to
- name: date_added
为此:
- kind: monthly_report
properties:
- name: date_added
- name: belongs_to
看起来订单很重要,所以我改变了这个:
- kind: monthly_report
properties:
- name: belongs_to
- name: date_added
为此:
- kind: monthly_report
properties:
- name: date_added
- name: belongs_to
我已经在gcloud shell中运行了命令gcloud datastore cleanup index
和gcloud datastore create index index.yaml
。在运行上述注释中的第二个命令后,它一定已经创建了索引。在该index.yaml
文件中,只需添加上述缺少的索引并重新部署即可。没有缺少的索引您的问题本身就是说您遇到了缺少索引的错误。您面临的确切问题是什么?这是我的问题,在我发布my index.yaml文件的问题中,有kind月报
,属性属于
和添加日期
。我使用添加日期
和属于
的过滤器查询kind付款
。他正在工作。使用相同的方法,我查询种类月度报告
,并在日期添加过滤器
,属于
,我已经在gcloud shell中运行命令gcloud datastore cleanup index
和gcloud datastore create index index.yaml
。在运行上述注释中的第二个命令后,它一定已经创建了索引。在该index.yaml
文件中,只需添加上述缺少的索引并重新部署即可。没有缺少的索引您的问题本身就是说您遇到了缺少索引的错误。您面临的确切问题是什么?这是我的问题,在我发布my index.yaml文件的问题中,有kind月报
,属性属于
和添加日期
。我使用添加日期
和属于
的过滤器查询kind付款
。他正在工作。使用相同的方法,我查询了种类月报
,并在日期添加了过滤器
,属于
,我得到了上面的错误。