Dynamodb updateitem仅具有全局二级索引

Aru*_* SS 4 bigdata nosql amazon-dynamodb

我们可以仅使用全局二级索引来更新dynamodb项目吗?

$response = $dynamodbClient->updateItem(array(
            'TableName' => 'feed',
            'Key' => array(
                'feed_guid'      => array('S' => 'ac1e9683832ad2923f0bd84b91f34381'),
                'created_date'   => array('N' => '1439295833'),
            ),
            "ExpressionAttributeValues" =>  array (
                    ":val1" => array('N' => '1')
                ) ,
            "UpdateExpression" => $updateExpression,  
            'ReturnValues' => 'ALL_NEW'
        ));
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,我想替换关键部分并使用全局二级索引(即user_id)更新项目。

mko*_*bit 7

不可以,您不能更新GSI中的项目。您对表中的项目进行更改/更新,并且这些更新将传播到GSI。