Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

search text in dynamodb, break up tables

Currently, I'm thinking of how to search a keyword within a string of text (e.g. search "happy" inside the string "I'm a very happy man" and return to me that text) using AWS DynamoDB. Is there a way to query this?

What I know of is that Query allows "begin with" or "between" which doesn't really help me in this case.

Also, lets say i have a million records in the table "A", is it easy to migrate data into a different table "B"/"C" if I break up table "A"?

Thanks in advance!

like image 941
K.Liu Avatar asked Jun 12 '15 16:06

K.Liu


People also ask

Does DynamoDB support search?

You can specify a DynamoDB table as a source when configuring indexing options or uploading data to a search domain through the console. This enables you to quickly set up a search domain to experiment with searching data stored in DynamoDB database tables.

How does DynamoDB search work?

In a Query operation, DynamoDB retrieves the items in sorted order, and then processes the items using KeyConditionExpression and any FilterExpression that might be present. Only then are the Query results sent back to the client. A Query operation always returns a result set.

What is the difference between getItem and query in DynamoDB?

getItem retrieve via hash and range key is a 1:1 fit, the time it takes (hence performance) to retrieve it is limited by the hash and sharding internally. Query results in a search on "all" range keys. It adds computational work, thus considered slower.

What is conditional writes in DynamoDB?

Conditional writes can be idempotent if the conditional check is on the same attribute that is being updated. This means that DynamoDB performs a given write request only if certain attribute values in the item match what you expect them to be at the time of the request.


1 Answers

DynamoDB cannot efficiently do a query for "Contains" keyword because it doesn't build indices to do so. The only indices that are built are those on the primary key (hash or hash and range), local secondary indices and global secondary indices. Using the CONTAINS filter in scan will cause Dynamo DB to perform a full table scan, which could potentially eat a lot of your configured read throughput, causing other queries to get throttled. You can consider scan with CONTAINS filter if this is not a concern for you.

AWS cloud search is more appropriate for full text search queries. The AWS cloud search service has a section documenting how data in DynamoDB maybe queried - http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-dynamodb-data.html.

like image 116
Rohit Kulshreshtha Avatar answered Sep 23 '22 15:09

Rohit Kulshreshtha