Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to batchGet index table in 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).

like image 463
Solo Avatar asked Feb 28 '17 05:02

Solo


1 Answers

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 — (String) Determines the level of detail about provisioned throughput consumption that is returned in the response:

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 - The response includes only the aggregate ConsumedCapacity for the operation. NONE - No ConsumedCapacity details are included in the response.

like image 54
notionquest Avatar answered Nov 11 '22 13:11

notionquest