创建多个GSIS通过updateTable - DynamoDB [英] Creating multiple GSIs by updateTable - DynamoDB

查看:186
本文介绍了创建多个GSIS通过updateTable - DynamoDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我uisng updateTable 的DynmaoDB并根据文件,如果我们要建立多个全球辅助索引(GSIS),我们需要在GlobalSecondaryIndexUpdates字段多个对象,所以我通过下面的参数,可以但不更新GSIS;但是如果我只是创建1 GSI(传递一个对象在GlobalSecondaryIndexUpdates字段,它的工作原理);这里是我通过创建多个GSIS的PARAMS:

I'm uisng updateTable of DynmaoDB and based on the documentation, if we want to create multiple Global Secondary Indexes (GSIs) we need to have multiple objects in "GlobalSecondaryIndexUpdates" field, so I'm passing the following params, but it does not update the GSIs; however if I'm just creating one GSI (passing one object in "GlobalSecondaryIndexUpdates" field, it works); here is the params I'm passing for creating multiple GSIs:

{
    "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"
                }
            }
        }]
}

我是不是传递PARAMS的格式不正确?

Am I passing the params in a wrong format?

推荐答案

从DynamoDB <一href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.OnlineOps.html#GSI.OnlineOps.Creating"相对=nofollow>文档:

From the DynamoDB documentation:

您只能创建或删除每一个全局二级索引   UpdateTable操作。但是,如果你运行多个UpdateTable   操作同时,可以同时创建多个索引。   您可以在一个表上运行多达五个这些UpdateTable操作   一次,并且每个操作可以创建正好一个索引

You can only create or delete one global secondary index per UpdateTable operation. However, if you run multiple UpdateTable operations simultaneously, you can create multiple indexes at a time. You can run up to five of these UpdateTable operations on a table at once, and each operation can create exactly one index.

这篇关于创建多个GSIS通过updateTable - DynamoDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆