Search for text in dynamodb, split tables

I'm currently thinking about how to search for a keyword in a line of text (for example, searching “happy” inside the line “I am very happy person” and returning this text to me) using AWS DynamoDB. Is there any way to request this?

What I know about is that Query allows you to “start with” or “between,” which doesn't really help me in this case.

Also, let's say I have a million records in table "A", is it easy to transfer data to another table "B" / "C" if I split table "A"?

Thanks in advance!

+6
source share
3 answers

DynamoDB cannot efficiently execute a query for the keyword "Contains" because it does not create indexes for this. The only indexes that were built are primary keys (hash or hash and range), local secondary indexes, and global secondary indexes. Using the CONTAINS filter during scanning will cause Dynamo DB to perform a full table scan, which could potentially consume a lot of configured read performance, causing other queries to fade. You may consider scanning with the CONTAINS filter if this does not bother you.

AWS Cloud Search is more suitable for full-text search queries. AWS Cloud Search has a section documenting how data can be queried in DynamoDB - http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-dynamodb-data.html .

+5
source

Amazon CloudSearch is probably what you are looking for:

You can specify the DynamoDB table as the source when setting indexing options or loading data into the search domain using the console tools or the command line. This allows you to quickly set up a search domain for experiments with searching data stored in DynamoDB database tables.

http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-dynamodb-data.html

+1
source

It looks like you are looking for Contains condition :

If the target comparison attribute is of type String, then the operator checks if the substring matches.

You did not specify how you are requesting DynamoDB, so unfortunately I cannot give you a concrete example. However, if you use java, you are probably using QueryFilter .

Your second question seems to have already been answered.

0
source

Source: https://habr.com/ru/post/989021/


All Articles