我正在尝试在我的数据存储上运行 GQL 查询。像这样的东西:
SELECT * FROM products WHERE model = @model AND date >= @date
但是有如下错误:
You need an index to execute this query.
在 google api 文档中,我没有发现任何关于 nodejs 的索引。我如何设置这个索引?
我正在尝试在我的数据存储上运行 GQL 查询。像这样的东西:
SELECT * FROM products WHERE model = @model AND date >= @date
但是有如下错误:
You need an index to execute this query.
在 google api 文档中,我没有发现任何关于 nodejs 的索引。我如何设置这个索引?
不幸的是,截至今天,该gcd
工具不支持使用 JSON 接口(如 Node.js 或 Ruby)的语言自动生成索引。
一种解决方法是手动定义您的索引<your-dataset-directory>/WEB-INF/datastore-indexes.xml
<?xml version="1.0" encoding="utf-8"?>
<datastore-indexes
autoGenerate="true">
<datastore-index kind="product" ancestor="false">
<property name="model" direction="asc" />
<property name="date" direction="asc" />
</datastore-index>
</datastore-indexes>
有关更多详细信息,请参阅数据存储文档的索引配置部分。