使用 Amazon Dynamo DB 进行不区分大小写的查询

在 DynamoDB 中,字符串值区分大小写.在我的应用程序中,用户可以在数据库中搜索个人资料名称.但是,如果他们搜索alan",则搜索结果中不会返回Alan".如何允许用户指定不区分大小写的搜索来检索好的结果?

In In DynamoDB, string values are case sensitive. In my app, users can search the db for a profile name. However, if they searched for, say 'alan', then 'Alan' would not be returned in the search results. How can I allow users to specify case insensitive searches to retrieve good results?

仅供参考:我将 DynamoDB 与 Node.js 和 Express 结合使用,AngularJS 在前端.对 db 的扫描请求的脚本位于 Express route js 文件中;解释用户请求并发送到服务器的代码位于 AngularJS 控制器中.

FYI: I'm using DynamoDB with Node.js and Express, with AngularJS on the front-end. The script for the scan request to the db sits in an Express route js file; the code to interpret the user request and send to the server is in an AngularJS controller.

推荐答案

您可以使用 Lambda 函数将您的 DynamoDB 表连接到 AWS ElasticSearch,以便将表中的更新流式传输以进行索引.ElasticSearch 允许全文和不区分大小写的查找,因此它正是您要查找的内容.这是一个 AWS 解决方案架构师的示例架构.AWS 实验室还提供了完成相同任务的 DynamoDB Logstash 插件.

You can hook up your DynamoDB table to AWS ElasticSearch with a Lambda function to stream updates in your table to be indexed. ElasticSearch allows full text and case-insensitive lookups so it is exactly what you are looking for. Here is an example architecture by AWS solution architects. AWS Labs also offers the DynamoDB Logstash plugin that accomplishes the same task.

相关文章