Say, in AWS Dynamo, I have a table like this:
ID (HKey) Date (RKey) BoxName
0 1/1/2014 Box-1
1 2/1/2014 Box-1
2 3/1/2014 Box-2
3 4/1/2014 Box-3
4 5/1/2014 Box-3
5 5/1/2014 Box-1
I want to, in a single query, get the first row for each unique Box. There could be hundreds of boxes I need the first entry for at once, making individual requests inefficient.
I can't seem to find anything in the API that would allow me to do this. Is it possible? How would I do this?
You might want to consider creating a Global secondary index (GSI) on Boxname (hash key) and date as your range key. This will enable you to use Query API on the secondary index where you can query "Find all IDs with Boxname = $box".
See the documentation for GSI.
Hope this helps, Swami
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With