What should the developer do to meet these requirements?
Add a global secondary index (GSI) to the DynamoDB table with customer_type as the partition key and email_address as the sort key. Perform a query operation on the GSI by using the begins_with key condition expression with the email_address property.
Add a global secondary index (GSI) to the DynamoDB table with email_address as the partition key and customer_type as the sort key. Perform a query operation on the GSI by using the begins_with key condition expression with the email_address property.
Add a local secondary index (LSI) to the DynamoDB table with customer_type as the partition key and email_address as the sort key. Perform a query operation on the LSI by using the begins_with key condition expression with the email_address property.
Add a local secondary index (LSI) to the DynamoDB table with job_title as the partition key and email_address as the sort key. Perform a query operation on the LSI by using the begins_with key condition expression with the email_address property.
Explanations:
This option adds a GSI withcustomer_typeas the partition key andemail_addressas the sort key. The query can then use thebegins_withcondition to perform a partial match search on theemail_addressproperty for a specificcustomer_type. This meets the requirement of partial email address matching without needing to recreate the table.
This option adds a GSI withemail_addressas the partition key andcustomer_typeas the sort key. The query would not work as intended because the developer needs to query bycustomer_type(notemail_address) to filter the data. The GSI’s partition key should becustomer_type, notemail_address, to meet the requirement.
A local secondary index (LSI) would not work for this use case because LSIs are only useful when querying based on the same partition key. In this case, querying bycustomer_typerequires a GSI, not an LSI, as LSIs require the same partition key (email_addressin this case) for filtering.
This option uses an LSI withjob_titleas the partition key, which does not align with the requirement to search bycustomer_type. Thejob_titledoes not serve as a useful partition key for this query, and LSIs are limited to querying by the same partition key as the base table.