I can query a GSI via DynamoDB console as can be seen in the screenshot.
When I run the same query with Boto3 on terminal with the following code:
table.query(
IndexName='date-timestamp-index',
KeyConditionExpression=Key('date').eq('20161231'),
FilterExpression=Attr('timestamp').between(1483130000, 1483133600) & Attr('tags').exists()
)
I get a ValidationException
exception:
Filter Expression can only contain non-primary key attributes: Primary key attribute: timestamp
What am I doing wrong here? Thanks.
Your timestamp
field is the sort key of the table, so it cannot be used in FilterExpression. It must be part of the KeyConditionExpression.
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