I have a dynamodb table with a structure something like:
{
Type: 'AWS::DynamoDB::Table',
Properties: {
KeySchema: [
{
AttributeName: 'itemID',
KeyType: 'HASH'
}
],
AttributeDefinitions: [
{
AttributeName: 'itemID',
AttributeType: 'S'
},
{
AttributeName: 'label',
AttributeType: 'S'
}
],
GlobalSecondaryIndexes: [
{
IndexName: 'byLabel',
KeySchema: [
{
AttributeName: 'label',
KeyType: 'HASH'
}
],
Projection: {
ProjectionType: 'ALL'
}
}
]
}
}
For one of my access patterns I want to get all the data that contains a label with a specific sub string. I'm very new to dynamodb, so I am unsure of the best way to achieve this.
I have it working for equals like below. HoweverI would prefer more results so returning data that contains the input would be ideal.
Current request VTL template:
{
"version": "2018-05-29",
"operation": "Query",
"query": {
"expression": "label = :label",
"expressionValues": {
":label": $util.dynamodb.toDynamoDBJson($context.arguments.label)
}
},
"index": "byLabel",
}
I am looking for advice on how this is usually done with a dynamodb implementation.