Bry*_*uro 11 java amazon amazon-web-services amazon-dynamodb
我目前正在使用Java dynamoMapper来创建和查询表.尝试使用全局二级索引创建表时,出现以下错误
No provisioned throughput specified for the global secondary index
我表示该表的java类具有全局二级索引的此属性.
@DynamoDBIndexHashKey(globalSecondaryIndexName="sender")
public String getSender() {
return sender;
}
Run Code Online (Sandbox Code Playgroud)
创建表的类看起来像这样
public boolean createTable() {
try {
DynamoDBMapper mapper = new DynamoDBMapper(client);
CreateTableRequest tableRequest = mapper.generateCreateTableRequest(entityClass); // 1
tableRequest.setProvisionedThroughput(new ProvisionedThroughput(1000L, 1500L)); // 2
client.createTable(tableRequest); // 3
} catch (Error e) {
e.printStackTrace();
return false;
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
我在亚马逊网站上搜索了其他注释和配置,但没有为DynamoMapper提供任何信息.无论如何使用ORM执行此操作还是必须使用较低级别的API手动创建?
小智 16
您还需要在将生成的每个辅助索引表上设置预配置吞吐量.
tableRequest.getGlobalSecondaryIndexes().get(0).setProvisionedThroughput(new ProvisionedThroughput(10l, 10l));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3575 次 |
| 最近记录: |