- Le plus récent
- Le plus de votes
- La plupart des commentaires
Create a GSI where the PK is Country+Location concatenated and the SK is the last_updated. Then for any given Country+Location value you can find the last updated values (and corresponding customer ids in the projection) for that location. Note you can setup 20 GSIs.
Or are you hoping to do a begins_with against the location (like for the wider value of WA:King) while also getting only the latest X many? In which case, well, you can't. You can however insert new items for each hierarchical level (like WA:King, etc) so that that value can be used as the PK. Basically pre-materialize at each level. You only get one sort key per table/index and you can't use the sort key functionality twice.
Of course, if you intend to get ALL the matching items (not just the latest X many) and just want them sorted, you can sort on the client.
Contenus pertinents
- demandé il y a 2 ans
- demandé il y a 5 mois
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 9 mois
- AWS OFFICIELA mis à jour il y a 8 mois
- AWS OFFICIELA mis à jour il y a 2 ans
Thanks! I was indeed hoping to do something like a
begins_with
, so it looks like I'm a little out of luck. I think what I'm going to do is create a different GSI for each potential level of hierarchy (e.g. one for Country, one for State, etc.) with the location as the PK andlast_updated
as the SK, and query the appropriate GSI based on the level of hierarchy needed.