如何在 DynamoDB 中批量获取索引表? [英] How to batchGet index table in DynamoDB?

查看:23
本文介绍了如何在 DynamoDB 中批量获取索引表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 DynamoDB 中批量获取全局二级索引?

How to batchGet global secundary index in DynamoDB?

这些参数给了我一个架构错误,因为这个哈希键只在索引表中,主要有其他的.

These params gives me a schema error because this hash key is only in index table, main has other.

  const params = {
    RequestItems: {
      "MyTableName": {
        Keys: [
           {
              "ThisHashKeyIsOnlyInIndexTable": value
           }
        ]
      }
    }
  };

  docClient.batchGet(params, (err, data) => {
    // ...
  }

文档甚至没有提到如何仅从索引中批量获取.

Docs doesn't even mention how to batchGet only from index(es).

推荐答案

很遗憾,GetItemBatchGetItem 无法访问任何索引.您不能在类似于 Query API 的参数上传递 IndexName.

Unfortunately, the GetItem and BatchGetItem, can not access any indexes. You can't pass IndexName on params similar to Query API.

突出显示与问题相关的要点.

Highlighted the point relevant to the question.

ReturnConsumedCapacity —(字符串)确定有关的详细程度响应中返回的预配置吞吐量消耗:

ReturnConsumedCapacity — (String) Determines the level of detail about provisioned throughput consumption that is returned in the response:

INDEXES - 响应包括聚合的 ConsumedCapacity操作,以及每个表和辅助的 ConsumedCapacity被访问的索引.注意一些操作,比如GetItem和 BatchGetItem,根本不访问任何索引.在这些情况下,指定 INDEXES 将只返回 ConsumedCapacity 信息表.

INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem, do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).

TOTAL - 响应仅包括 ConsumedCapacity 的总和操作.NONE - 没有 ConsumedCapacity 详细信息包含在回应.

TOTAL - The response includes only the aggregate ConsumedCapacity for the operation. NONE - No ConsumedCapacity details are included in the response.

这篇关于如何在 DynamoDB 中批量获取索引表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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