DVA-C02 · Question #160
A developer is creating an AWS Lambda function that searches for items from an Amazon DynamoDB table that contains customer contact information. The DynamoDB table items have the customer's…
The correct answer is A. Add a global secondary index (GSI) to the DynamoDB table with customer_type as the partition. By adding a global secondary index (GSI) to the DynamoDB table with customer_type as the partition key and email_address as the sort key, the developer can perform a query operation on the GSI using the Begins_with key condition expression with the email_address property. This…
Question
A developer is creating an AWS Lambda function that searches for items from an Amazon DynamoDB table that contains customer contact information. The DynamoDB table items have the customer's email_address as the partition key and additional properties such as customer_type, name and job_title. The Lambda function runs whenever a user types a new character into the customer_type text input. The developer wants the search to return partial matches of all the email_address property of a particular customer_type. The developer does not want to recreate the DynamoDB table. What should the developer do to meet these requirements?
Options
- AAdd a global secondary index (GSI) to the DynamoDB table with customer_type as the partition
- BAdd a global secondary index (GSI) to the DynamoDB table with email_address as the partition
- CAdd a local secondary index (LSI) to the DynamoDB table with customer_type as the partition key
- DAdd a local secondary index (LSI) to the DynamoDB table with job_title as the partition key and
How the community answered
(15 responses)- A73% (11)
- B7% (1)
- C13% (2)
- D7% (1)
Explanation
By adding a global secondary index (GSI) to the DynamoDB table with customer_type as the partition key and email_address as the sort key, the developer can perform a query operation on the GSI using the Begins_with key condition expression with the email_address property. This will return partial matches of all email_address properties of a specific customer_type.
Community Discussion
No community discussion yet for this question.