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

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

问题描述

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

How to batchGet global secundary index in DynamoDB?

这些参数给我一个架构错误,因为此哈希键仅在索引表中,main在其他表中.

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:

索引-响应中包含 操作,以及每个表和辅助数据库的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 操作.无-消耗能力的详细信息不包含在 响应.

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

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

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