Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 412未找到匹配索引错误_Python_Google Cloud Datastore_Google Cloud Platform - Fatal编程技术网

Python 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

我有以下错误:

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
将创建索引:

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
付款
。他正在工作。使用相同的方法,我查询了种类
月报
,并在
日期添加了过滤器
属于
,我得到了上面的错误。