- 新しい順
- 投票が多い順
- コメントが多い順
The "ExclusiveStartKey" setting is optional.
So, it is not necessary to specify it at the very first execution.
LastEvaluatedKey is included in the response when all data could not be retrieved during the first scan.
The first run will scan without specifying ExclusiveStartKey.
If the response from the first run contains LastEvaluatedKey, put a value in ExclusiveStartKey and run it again.
So I think you need to change the content of your API a bit.
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html
Since the ExclusiveStartKey attribute is optional. I just had to modify mi API request mapping by removing the ExclusiveStartKey like this:
{
"TableName": "Test-Table",
"Limit": 10000,
"FilterExpression": "wb_date = :val",
"ExpressionAttributeValues": {
":val": {
"S": "$input.params('wb_date')"
}
},
"ReturnConsumedCapacity": "TOTAL"
}
Despite removing it, the API still process it when I consume it with 0 value or with a real Id value
関連するコンテンツ
- 質問済み 6年前
Thanks a lot! It worked. I just have to modify mi API request mapping by removing the ExclusiveStartKey
Hey Riku. After testing it, if ExclusiveStartKey is not declared in the Mapping Request, the params do not pass to the API. So that, the scan does not start where it should.
I deleted the ExclusiveStartKey field from my JSON:
{ "TableName": "Test-Table", "Limit": 10000, "FilterExpression": "wb_date = :val", "ExpressionAttributeValues": { ":val": { "S": "$input.params('wb_date')" } }, "ReturnConsumedCapacity": "TOTAL" }
Maybe I understood wrong. Is this what you meant?
Yes, it is. The following document states that the value used for "ExclusiveStartKey" uses "LastEvaluatedKey". In other words, it is a parameter for retrieving the data that could not be retrieved in the first request from the continuation. https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html#DDB-Scan-request-ExclusiveStartKey