Home > Software design >  Simple Search capabilities with NoSql (DynamoDB)
Simple Search capabilities with NoSql (DynamoDB)

Time:09-27

I am new to NoSQL. I am trying to make simple app which will have products that you search through. With SQL I would simply have a products table and be able to search any of the columns for substrings with %LIKE% and pull the returned rows. I would like to use DynamoDB, but seemingly there is no way of doing this without introducing AWS OpenSearch (ElasticSearch) which will probably cost more than all my DynamoDb tables. Is there any simple way to do this in DynamoDb without having to scan the whole table and filtering with contains?

CodePudding user response:

No, there is no way to do what you want (search dynamodb) without adding in another layer such as elasticsearch - keep it simple, use a traditional database.

IMO, never assume you need a nosql database - because you rarely do - always assume you need a traditional database until proven otherwise.

CodePudding user response:

Ok so DynamoDB is not what you are looking for, it is designed for a very different use case.

However, ElasticSearch which is in no way tied to DynamoDB very much is what you are looking for and will greatly simplify what you are trying to over using a traditional SQL database. Those who are saying otherwise, are providing poor information. A traditional database cannot index a %LIKE% query, where this is precisely what ElasticSearch does on every field in your document.

Getting started with ElasticSearch is super easy. Just download the Jar and run it, then start going through examples posting and getting documents from the index. If your experience is anything like mine, you will never really want to use a SQL database again, but as is mentioned they each have their own place, and so I do still use traditional RDBMS but I specialize in ElasticSearch.

I have converted many applications that were unable to find reasonable performance, to ElasticSearch where the performance is almost always sub second, and typically a fraction of that. An RDBMS being asked to do many %LIKE% matches will not be able to provide you sub second results.

There are also a number of tools that will automatically funnel data from your RDBMS db into ElasticSearch so that you can have the benefits of both worlds.

NoSQL means a great many things. In general it has been applied to at several classes of datastore.

Columnar Datastore - DynamoDB, Hive Document/Object Database - MongoDB, CouchDB, Mark Logic, and a great many others Key/Value - Cassandra, MongoDB, Redis, Memcache Search Index - SOLR, ElasticSearch

ElasticSearch bridges the gap between Document Database and Search Index, providing the features of both. It also provides the capabilities of a Key/Value data store.

The columnar datastore is much more tuned for doing work across massive amounts of data, generally in an aggregate, but results from the queries are not the kind of performance you are looking for. These are used for datasets with trillions of rows and hundreds of features/columns.

ElasticSearch however provides very rapid search across large numbers of JSON documents index by default every value in the json.

The way to do this with dynamodb is by using ElasticSearch, however, you do not need DynamoDB to do this with ElasticSearch, so you dont need double the cost.

  • Related