You are developing an application that is working with a DynamoDB table.
You need to create a query that has search criteria.
Which of the following must be done to work with search queries? Choose 2 answers from the options given below.
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - A and B.
The AWS Documentation mentions the following.
Key Condition Expression.
To specify the search criteria, you use a key condition expression-a string that determines the items to be read from the table or index.
You must specify the partition key name and value as an equality condition.
Option C is incorrect since you need to mention the partition key and not the sort key.
Option D is incorrect since this is used to filter results further.
For more information on working with queries, please refer to the below URL-
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.htmlWhen working with DynamoDB, search queries can be performed using the Query API. To perform a search query in DynamoDB, you must specify the partition key (or the partition key and sort key) that will be used to retrieve the items from the table.
To work with search queries, the following must be done:
Specify a partition key name and value in the equality condition: When using the Query API, you must specify the partition key value for the items you want to retrieve. This is done using the KeyConditionExpression parameter. The partition key value must be an exact match, and you can only specify one partition key value at a time.
Specify a sort key name and value in the equality condition: If your table has a sort key, you can also use it to refine your search by specifying a sort key value in the KeyConditionExpression. The sort key value must also be an exact match, and you can only specify one sort key value at a time.
Therefore, options B and C are the correct answers. Option A is not sufficient on its own, as it does not specify the partition key value. Option D refers to the FilterExpression, which is used to further refine the results of a Query operation after the initial KeyConditionExpression has been evaluated.