I'm new to dynamodb and trying to create a global secondary index for addition access patterns.
How can I create dynamoDB GSI with composite sort key?
For example: my primary table stored orders, which has these fields User_ID,ID, Type, Product_name, Total_Value, Created_at
On my primary table, the partition key is User_ID and sort key is Created_at, so I can get user's order history for the UI.
My application also needs to get all orders by name, filtered by type, sorted by total_value and Created_at
so I'm thinking of create a GSI with:
- Parition key:
Product_name - Sort key:
Type#Total_value#Created_at
But when creating a new GSI I encountered this error:
Global Secondary Index range key not specified in Attribute Definitions.Type unknown.
So what should I do to create that GSI?