AWS 更新 table 不工作

AWS Update table not working

我正在使用 DynmaoDB updateTable,我正在传递以下参数对象:

{
    "TableName": "movies",
    "AttributeDefinitions": [{
            "AttributeName": "subtitle",
            "AttributeType": "S"
        }],
    "GlobalSecondaryIndexUpdates": [{
            "Create": {
                "IndexName": "subtitle",
                "ProvisionedThroughput": {
                    "ReadCapacityUnits": "5",
                    "WriteCapacityUnits": "5"
                },
                "KeySchema": [{
                        "AttributeName": "subtitle",
                        "KeyType": "HASH"
                    }],
                "Projection": {
                    "ProjectionType": "ALL"
                }
            }
        }],
    "ProvisionedThroughput": {
        "ReadCapacityUnits": "5",
        "WriteCapacityUnits": "5"
    }
}

但它给了我以下错误:

但是基于 documentation 我需要通过它们?!那么为什么它会给我这个错误?

更新:

感谢苗丹妮的建议,我的问题通过更改SDK版本得到解决;但我 运行 进入另一个问题;再次基于 documentation,如果我们想创建多个 GSI,我们需要在 "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"
                }
            }
        }]
}

我传递的参数格式有误吗?

谢谢 :-)

您使用的是哪个版本的 SDK?我相信向现有 table 添加索引是最近发布的一项新功能,因此它应该只在最新的 SDK 版本 2.1.8 中得到支持:http://aws.amazon.com/releasenotes/SDK/JavaScript/3682546508553819