我正在尝试在包含30列的表上创建GSI(使用ruby SDK)。我使用projection_type:'ALL' - 但我仍然得到以下异常:
Aws::DynamoDB::Errors::ValidationException: One or more parameter values were invalid: Number of projected attributes in all indexes exceeds limit of 20, number of projected attributes:30
据我所知,这只应在使用INCLUDE
projection_type:
此限制不适用于ProjectionType为KEYS_ONLY或ALL的二级索引。 http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-secondary-indexes
create语句类似于:
connection.update_table({
table_name: "my-table", # required
attribute_definitions: [
{
attribute_name: "indexDate",
attribute_type: "S",
},
{
attribute_name: "createdAt",
attribute_type: "S",
},
],
global_secondary_index_updates: [
{
create: {
index_name: "my-new-index", # required
key_schema: [
{
attribute_name: "indexDate",
key_type: "HASH",
},
{
attribute_name: "createdAt",
key_type: "RANGE",
},
],
projection: { # required
projection_type: "ALL"
},
provisioned_throughput: { # required
read_capacity_units: 10, # required
write_capacity_units: 300, # required
}
}
}
]
})
答案 0 :(得分:0)
原来,属性限制限制遍及桌面上的所有GSI。我有另一个导致这个失败的人。删除了那个,然后就可以了。