Skip to content
Advertisement

Case insensitive query in DynamoDB

I want to scan/query the dynamo DB table. Dynamo DB is case sensitive. I want to use Hash/ Range keys sometimes as strings. Is there any way we can enable case insensitivity in dynamo DB level ? Or is there any other solutions exist? I am querying the Dynamo with the JAVA SDK

Advertisement

Answer

There are 2 possible ways I can think of

1) Solve at the application end by tweaking the schema

e.g Let say you have “Name” as hash key now whenever new users are added you add them after making their name in lower-case

John --> john

Doe --> doe

Remember to store both the value (name as hash for searching) and (displayName for displaying purpose)

Now before querying the database, you can convert you search to lower-case.

2) Use ElasticSearch: DyanmoDB table can be integrated with ElasticSearch which can perform different search operations on your table (refer link)

Advertisement