表: EmailMessages
EntityId - HashKey : String
Id - RangeKey : String
名称-字符串
状态字符串
我想为身份做一个GlobalSecondaryIndex
var request = new UpdateTableRequest
{
TableName = "EmailMessages",
GlobalSecondaryIndexUpdates = new List<GlobalSecondaryIndexUpdate>
{
new GlobalSecondaryIndexUpdate
{
Create = new CreateGlobalSecondaryIndexAction
{
IndexName = "GSI_EmailMessages_Status",
KeySchema = new List<KeySchemaElement>
{
new KeySchemaElement("Status", KeyType.HASH)
}
}
}
}
};
var client = DynamoDBManager.DBFactory.GetClient();
client.UpdateTable(request);然而,我得到的返回错误是一个没有返回文本的500错误,所以我不确定我需要纠正什么才能使它工作。我已经仔细研究了文档,似乎在为现有表创建GSI方面找不到什么帮助。任何帮助都将不胜感激。
发布于 2015-07-30 14:56:06
我设法解决了我的问题。结果我需要更多的代码。我将发布我的解决方案,以防其他人遇到类似的问题,因为似乎还没有为Dynamo提供多少资源。请注意,我的读写能力非常低,因为这是一个开发环境。你可能会考虑根据你的需要来提高你的
var request = new UpdateTableRequest
{
TableName = "EmailMessage",
AttributeDefinitions = new List<AttributeDefinition>
{
new AttributeDefinition
{
AttributeName = "Status",
AttributeType = ScalarAttributeType.S
}
},
GlobalSecondaryIndexUpdates = new List<GlobalSecondaryIndexUpdate>
{
new GlobalSecondaryIndexUpdate
{
Create = new CreateGlobalSecondaryIndexAction
{
IndexName = "GSI_EmailMessage_Status",
KeySchema = new List<KeySchemaElement>
{
new KeySchemaElement("Status", KeyType.HASH)
},
Projection = new Projection
{
ProjectionType = ProjectionType.ALL
},
ProvisionedThroughput = new ProvisionedThroughput
{
ReadCapacityUnits = 4,
WriteCapacityUnits = 1,
}
}
}
}
};
var client = DynamoDBManager.DBFactory.GetClient();
client.UpdateTable(request);https://stackoverflow.com/questions/31711749
复制相似问题