我有一个在Firestore模式下配置了数据存储的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向后兼容,希望这会正常工作。)