I am new to dynamoDb and exploring its docs these days. I read about secondary index in dynamodb and have a small confusion. When we create a secondary index we specify partition and sort key (optional) for that index but do we also add attributes to secondary index which which we'll be querying using the secondary index?
Let's say, I have a table named Person and it contain attributes such as Name, Age, Gender, Contact, Star. It has name as the partition key and now I want to create a secondary index on Age such that I can query using Age and get the attributes - contact, star, name. Should I add these attributes (contact, star, name) to secondary index as well while creating it or I can just need to specify partition key (age in this case)?