0
votes

I'm using AWS (JS) Document Client library for DynamoDb and trying to do a batchGet from a table (partition+sort key). Issue is that I would like to get all items by partition key and any sort key.

If I don't define sort key in batchGet I get ValidationException: The provided key element does not match the schema. If I do - it works fine but is really inconvenient for me, and I can query same table by only partition key so I think I might be missing something.

1

1 Answers

0
votes

Try creating multiple Global Secondary Indexes (GSIs) using partition key and the multiple sort keys that you need for your application.

See https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.OnlineOps.html for reference.

Hope this helps!