6 amazon amazon-web-services nosql amazon-dynamodb
我uisng updateTable DynmaoDB的和基于文档,如果我们要建立多个全球辅助索引(GSIS),我们必须“GlobalSecondaryIndexUpdates”字段中的多个对象,所以我通过下面的参数,可以但不更新 GSI;但是,如果我只是创建一个 GSI(在“GlobalSecondaryIndexUpdates”字段中传递一个对象,它可以工作);这是我为创建多个 GSI 而传递的参数:
{
"TableName": "movies",
"AttributeDefinitions": [{
"AttributeName": "id",
"AttributeType": "N"
}, {
"AttributeName": "title",
"AttributeType": "S"
}, {
"AttributeName": "subtitle",
"AttributeType": "S"
}],
"GlobalSecondaryIndexUpdates": [{
"Create": {
"IndexName": "title",
"ProvisionedThroughput": {
"ReadCapacityUnits": "5",
"WriteCapacityUnits": "5"
},
"KeySchema": [{
"AttributeName": "title",
"KeyType": "HASH"
}],
"Projection": {
"ProjectionType": "ALL"
}
}
}, {
"Create": {
"IndexName": "subtitle",
"ProvisionedThroughput": {
"ReadCapacityUnits": "5",
"WriteCapacityUnits": "5"
},
"KeySchema": [{
"AttributeName": "subtitle",
"KeyType": "HASH"
}],
"Projection": {
"ProjectionType": "ALL"
}
}
}]
}
Run Code Online (Sandbox Code Playgroud)
我是否以错误的格式传递参数?
来自 DynamoDB文档:
每个 UpdateTable 操作只能创建或删除一个全局二级索引。但是,如果同时运行多个 UpdateTable 操作,则可以一次创建多个索引。您一次最多可以对一个表运行五个这样的 UpdateTable 操作,并且每个操作只能创建一个索引。
| 归档时间: |
|
| 查看次数: |
2319 次 |
| 最近记录: |