In my Android app, I want to query data from DynamoDB. There will be a thousand matching items, but I just want to get only the first 10 of them. I don't know how to set this limit. I found these lines in documentation:
The DynamoDB Query and Scan APIs allow a Limit value to restrict the size of the results.
In a request, set the Limit parameter to the number of items that you want DynamoDB to process before returning results.
In a response, DynamoDB returns all the matching results within the scope of the Limit value. For example, if you issue a Query or a Scan request with a Limit value of 6 and without a filter expression, DynamoDB returns the first six items in the table that match the specified key conditions in the request (or just the first six items in the case of a Scan with no filter). If you also supply a FilterExpression value, DynamoDB will return the items in the first six that also match the filter requirements (the number of results returned will be less than or equal to 6).
But I cannot find the way to set limit for response. I found the method SetCount of QueryResult:
QueryResult result2 = dynamodb.query(request);
result2.setCount(5);
It said that: then Count is the number of items returned after the filter was applied
But I think it is not what I want. Because DynamoDb still returns all the matching items before calling setCount. Can any one help me?