Complete the code to create a secondary index with a partition key.
Create a secondary index with partition key as [1].
The partition key defines how data is distributed in the index. Using UserId allows queries based on user identity.
Complete the code to query the secondary index using the partition key.
Query the index where partition key equals [1].Queries on a secondary index require specifying the partition key. Here, UserId is used to find related items.
Fix the error in the query by selecting the correct sort key attribute.
Query the index with partition key 'UserId' and sort key condition [1] = '2023-01-01'.
The sort key in the secondary index is Timestamp, which allows filtering by date or time.
Fill both blanks to define a global secondary index with partition and sort keys.
Define GSI with partition key [1] and sort key [2].
A global secondary index can have different partition and sort keys. Here, Category is partition key and CreatedAt is sort key for flexible queries.
Fill all three blanks to write a query using a secondary index with filter condition.
Query index where partition key is [1], sort key [2] '2023-06-01', and filter [3] = 'active'.
The query uses UserId as partition key, Timestamp as sort key with a condition, and filters results where Status is 'active'. This shows how secondary indexes enable flexible queries.