DynamoDB 中不区分大小写的查询 [英] Case insensitive query in DynamoDB

查看:42
本文介绍了DynamoDB 中不区分大小写的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想扫描/查询 dynamo DB 表.Dynamo DB 区分大小写.我有时想使用 Hash/Range 键作为字符串.有什么方法可以在 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

推荐答案

我能想到的方法有两种

1) 通过调整架构在应用端解决

例如,假设您现在有姓名"作为哈希键,每当添加新用户时,您在将他们的姓名设为小写后添加他们

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 集成,ElasticSearch 可以对您的表执行不同的搜索操作 (参考链接)

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

这篇关于DynamoDB 中不区分大小写的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆