Whenever i try to query a dynamodb table using C# document model, an exception will be raised as
do
{
var request = new QueryRequest
{
TableName = "oauth_users",
KeyConditionExpression = "user_id = :user_id",
ExpressionAttributeValues = new Dictionary<string, AttributeValue>
{{":user_id", new AttributeValue { S = userid_str }}},
// Optional parameters.
Limit = 1,
ExclusiveStartKey = lastKeyEvaluated
};
var response = client.Query(request);
// Process the query result.
foreach (Dictionary<string, AttributeValue> item in response.Items)
{
}
lastKeyEvaluated = response.LastEvaluatedKey;
} while (lastKeyEvaluated != null && lastKeyEvaluated.Count != 0);
Error :
Query condition missed key schema element: primary key
How can i query using a dynamodb key which is not a primary key but a global secondary index?