【发布时间】:2021-10-28 05:07:33
【问题描述】:
我有一个在 Firestore 模式下配置了 Datastore 的 Google Cloud Platform 项目,其中以下 (Python) 代码会产生 google.api_core.exceptions.FailedPrecondition: 400 no matching index found. 错误。
from google.cloud import datastore
store = datastore.Client(project='my-project')
query = store.query(kind='my-kind')
query.add_filter('start_date', '<', 1500000000)
results = query.fetch()
for r in results: # error thrown here
print(r)
由于 Firestore 自动索引单个字段(并且我没有从该自动索引中排除 start_timestamp 字段),我希望这可以工作。我做错了什么?
(请注意,这在 Datastore 处于 Datastore 而不是 Firestore 模式的另一个项目上非常有效;不幸的是,我碰巧需要使用的项目已经有 Firestore。由于 Firestore 应该与 Datastore 向后兼容,我曾希望这会正常工作。)
【问题讨论】:
标签: google-cloud-platform google-cloud-firestore google-cloud-datastore