小编Aus*_*Guo的帖子

在 DynamoDB 中批量查询 GSI?

是否可以在 GSI 上使用 DynamoDBMapper 同时对多个哈希键值创建单个查询?例如,如果我尝试使用 GSI 获取表 Table 中的所有相关记录,我将遍历所有散列键值并对每个散列键值进行单独查询。

即目前我正在做

    for (String s : listOfStrings) {
      Attribute thing = new Attribute();
      thing.setSomeField(s);
      DynamoDBQueryExpression<Attribute> queryExpression = 
         new DynamoDBQueryExpression<Attribute>()
            .withHashKeyValues(thing)
            .withIndexName("example-GSI")
            .withConsistentRead(false);
    }
Run Code Online (Sandbox Code Playgroud)

但我想在批处理调用而不是 for 循环中完成所有操作。

我检查了 DynamoDBMapper 文档,似乎没有,但我只是想知道这里是否有人对这种情况有任何好的解决方案。

amazon-web-services table-index amazon-dynamodb aws-sdk dynamodb-queries

4
推荐指数
1
解决办法
3146
查看次数