问题描述
我想扫描/查询发电机数据库表。 Dynamo DB区分大小写。我想有时将哈希键/范围键用作字符串。有什么方法可以使Dynamo DB级别不区分大小写?还是存在其他解决方案?我正在使用JAVA SDK查询Dynamo
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
推荐答案
我可以想到2种可能的方法
There are 2 possible ways I can think of
1)通过调整模式在应用程序端进行解决
例如,假设您有 Name作为现在,无论何时添加新用户,您都可以使用哈希键。在使用小写字母命名后,您就可以添加他们。
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
记住要同时存储两个值( name
作为用于搜索的哈希)和( displayName
用于显示目的)
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)使用ElasticSearch: DyanmoDB表可以与ElasticSearch集成在一起,从而可以对表执行不同的搜索操作()
2) Use ElasticSearch: DyanmoDB table can be integrated with ElasticSearch which can perform different search operations on your table (refer link)
这篇关于dynamo数据库中不区分大小写的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!