I am trying to optimize my query to dynamodb to return all matching items. From the cli I can query the table and it returns all 303 items.
CLI Request:
aws dynamodb query --table-name my-table --index-name "myGsi" --key-condition-expression 'myId=:someId' --expression-attribute-values '{":someId":{"S":"86c10962-6444-4f09-8f6c-dc6b30abac25"}}' Response:
{
"Items": [
{ ... },
{ ... }
],
"Count": 303,
"ScannedCount": 303,
"ConsumedCapacity": null
}
The problem is that when I try to recreate that query in my Typescript application, I only get ~60 items in the response (not always consistent).
Code:
const params: DocumentClient.QueryInput = {
TableName: 'my-table',
IndexName: 'myGsi',
KeyConditionExpression: 'myId = :someId',
ExpressionAttributeValues: {
':someId': '86c10962-6444-4f09-8f6c-dc6b30abac25',
}
};
const result: DocumentClient.QueryOutput = await dynamoClient.query(params).promise();
However, the result here is much smaller, and I need to paginate:
{
"Items": [
{ ... },
{ ... }
],
"Count": 59,
"ScannedCount": 59,
"LastEvaluatedKey": "xyz"
}
Any ideas on how to get all/more of the content in a single request from the SDK? Why would the results be different than my CLI request?