如何在不使用 GAE 的情况下创建复合索引?

How can I create composite index without using GAE?

我正在使用 Go SDK 开发 Google Cloud Datastore,遇到 GQL 查询错误 - "Your Datastore does not have the composite index (developer-supplied) required for this query." 我知道我需要创建复合索引。但是根据 Google Datastore document,它假定应用程序已启动并且 运行 宁作为 GAE,而在我的例子中,我们 运行 它在 GKE 和 Go SDK 上与 Datastore 一起工作。

所以我的问题是,是否只需要一个 GAE 实例来创建复合索引?

您不需要 GAE 实例来创建索引。

请参阅您在 "Deploying or deleting indexes" 上链接的文档中的部分。您需要创建一个 index.yaml 文件(参见 this page for examples) and then deploy it using the gcloud datastore create-indexes 命令。