【发布时间】:2020-11-12 14:09:14
【问题描述】:
我有一个包含约 70 个表的大型架构,其中许多表相互连接(194 个@connection 指令),如下所示:
type table1 @model {
id:ID!
name: String!
...
table2: table2 @connection
}
type table2 @model {
id:ID!
....
}
这很好用。现在我的数据量正在稳步增长,我需要能够查询结果并对其进行排序。
我已经阅读了几篇文章,发现一篇文章建议我创建一个 @key 指令来生成具有 2 个字段的 GSI,因此我可以说“根据我的过滤器属性过滤结果,按字段排序”名称" 并返回前 10 个条目,其余可通过 nextToken 参数访问"
所以我尝试像这样添加 GSI:
type table1 @model
@key(name: "byName", fields:["id","name"], queryField:"idByName"){
id:ID!
name: String!
...
table2: table2 @connection
}
运行
amplify push --minify
我收到错误提示
Attempting to add a local secondary index to the table1Table table in the table1 stack. Local secondary indexes must be created when the table is created.
An error occured during the push operation: Attempting to add a local secondary index to the table1Table table in the table1 stack.
Local secondary indexes must be created when the table is created.
为什么它会创建 LSI 而不是 GSI?在创建和填充表格后,有什么方法可以将 @key 指令添加到表格中?来自不同表的大量数据集相互关联,因此仅设置一个新架构需要很长时间。
Billingmode 是 PAY_PER_REQUEST,如果这有一些影响的话。
任何想法如何进行?
提前致谢!
问候克里斯蒂安
【问题讨论】:
-
有这方面的消息吗?我有同样的问题github.com/aws-amplify/amplify-cli/issues/…
-
这对medium.com/swlh/… 有帮助吗?他们说一次推一个 GSI
标签: amazon-web-services graphql amazon-dynamodb aws-amplify