Dynamodb Sort Key ENDS_WITH (KeyConditions - ComparisonOperator)


I want to be able to query my dynamoDb table using sort key ends_with operator, this is not possible currently since we only have "EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN" comparison operators. Why is this not possible currently and will it be available in the near future?

asked a year ago1482 views
1 Answer

If your use-case involves quickly finding objects based on their suffix in a specific field, consider extracting this suffix (assuming it's a fixed-size suffix) as another field and have a secondary index on that one. If you want to query arbitrary length suffixes, I would create a lookup table and update it with possible suffixes (or some of them, to save some calls, and then filter when querying).

Or you would need to use CONTAINS and then check your results

profile pictureAWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions