DynamoDB:表模式进行文本搜索 [英] DynamoDB: Table Schema fot text searching

查看:82
本文介绍了DynamoDB:表模式进行文本搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一些数据从MySQL移动到DynamoDB。现在我在满足我所有需求的模式设计上遇到了问题。我在MySQL中的表的格式如下:

I moving some data from MySQL to DynamoDB. Now I have a problem on schema design to fit all my needs. My Table in MySQL has schema like this:

userid - int
datetimemillis - int
typeid - int
string1 - string
string2 - string
string3 - string
string4 - string

主键是使用userid和datetimemillis构建的

Primary key is build with userid and datetimemillis

我需要执行以下查询:


  1. 检索特定用户ID的每一行

  2. 检索特定用户ID和类型ID的每一行

  3. 检索特定用户ID的每一行字符串1-4包含特定字符串的特定用户ID和类型ID

我能够执行1.和2.使用userId作为hashkey进行查询, typeId作为本地二级索引(删除具有特定userid的所有记录时需要使用范围键)。是否可以在不使用扫描的情况下进行第三个查询?我有什么可能?使用CloudSearch?还是其他亚马逊服务?如果我需要更改架构,请告诉我。价格无关紧要,即使我不得不使用五十个附加服务和dynamodb表,它也必须能够工作。

I am able to do 1. and 2. query using userId as hashkey, typeId as local secondary index (range key is needed for deleting all records with particular userid). Is there any option that I can make third query without using scan? What are my possibilities? Use CloudSearch? Or other amazon service? If I need to change my schema please tell me. Price does not matter, it only must work, even if I would have to use fifty additional services and dynamodb tables.

推荐答案

如果您尝试与String1-4进行完全字符串匹配,则可以使用更多本地二级索引。 DynamoDB支持多达5个本地二级索引。

If you are trying to do an exact string match with String1-4 you can use more local secondary indexes. DynamoDB supports up to 5 local secondary indexes.

但是(我想这就是您想要的)如果您要在这些字符串之一中搜索特定的包含项,我会使用solr之类的方法来索引所有内容这些字符串及其在solr中的对应userId,并从结果集交叉引用userId,以使用dynamodb用户表中的HashKey进行solr搜索。

But (I am thinking this is what you want) if you are trying to search for a specific contains inside one of those strings I would use something like solr to index all of those strings and its corresponding userId in solr and cross reference the userId from the resultset you get for a solr search with the HashKey in your dynamodb user table.

这篇关于DynamoDB:表模式进行文本搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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