2 Answers
- Newest
- Most votes
- Most comments
2
As Jason states, you cannot use a function on the partition key. But you can add a GSI which can help your achieve the use-case. This blog post outlines how you can achieve that.
GSI data:
PK | PicturePK | Data |
---|---|---|
1 | 123 | Data |
1 | 321 | Data |
1 | 355 | Data |
QuerySpec spec = new QuerySpec()
.withKeyConditionExpression("PK = :pk AND begins_with(PicturePK, :v_prefix) ")
.withValueMap(new ValueMap()
.withString(":v_prefix", prefix)
.withNumber(":pk", "1"));
0
With a query the partition key must be specified exactly. Sort keys can use begins_with.
answered 6 months ago
Relevant content
- Accepted Answerasked a year ago
- Accepted Answerasked 4 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 19 days ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
Thank you for the answer,
But can I make an index on the Partition Key to use functions on that index ?