【问题标题】:No matching index found even Google Cloud show them即使 Google Cloud 显示它们也找不到匹配的索引
【发布时间】:2018-04-29 18:00:53
【问题描述】:

我正在尝试执行以下查询:

SELECT google_uid FROM User WHERE api_key = @api_key

但我得到了错误:

没有找到匹配的索引。推荐的索引是:\n- kind: User\n 属性:\n - 名称:api_key\n - 名称:google_uid\n

这是来自 Google 的索引配置:

我昨天上传了它,所以我确信 Google 有时间更新它。

知道怎么解决吗?

谢谢

【问题讨论】:

  • 到目前为止,我一直在测试数据存储区中的数据,我发现一切正常。你能确定你的数据库中确实存在特定值“@api_key”吗?
  • 肯定存在

标签: google-cloud-platform google-cloud-datastore


【解决方案1】:

索引中的属性是有序的。所以你有一个 (google_uid, api_key) 的索引,但你没有 (api_key, google_uid) 的索引。此查询需要 (api_key, google_uid) 的复合索引。

如果您运行 querySELECT data_clicked from User where api_key = @api_key ,您可以看到这一点。这将起作用,因为您有一个索引,其中 api_key 是第一个属性。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-28
    • 1970-01-01
    • 1970-01-01
    • 2018-11-28
    • 1970-01-01
    • 1970-01-01
    • 2015-06-30
    相关资源
    最近更新 更多