23

I was just reading about elastic search and found that it indexes each and every term in the document as well as all fields. Although it has some disadvantages like it cannot provide transactions, etc. But for the application, where I only need to read data from DB and there is no write, is there any advantage to using Dynamo Db instead of Elastic Search. Earlier, I was thinking to use the Dynamo Db, but now after seeing that it indexes each and every field, so why not use Elastic Search itself. Till now, the only use case defined for my project is to search by an id. But in future, more use cases come, then it would be very difficult to add more indexes in Dynamo Db but would already be there in Elastic Search.

Can someone tell me of some advantages of Dynamo Db against Elastic Search.

Please give your suggestions.

hatellla
  • 4,796
  • 8
  • 49
  • 101

1 Answers1

23

I have used elasticsearch and MongoDB but not much Dynamodb. MongoDB works very well regarding indexing and strong consistency.

Few things I know about elasticsearch and DynamoDB;

elasticsearch is a search-engine, where you can search by any terms, or aggregate records based on certain criteria, but it also serves as a document-store, though was not primary purpose. And definitely great for less writes and more reads.

some elasticsearch advantages

elasticsearch disadvantages

  • has no Atomicity (A in ACID) between multiple documents

  • you might want to check security options, last time I used it maybe version 3, did not have good option

Dynamodb on the other hand is a datastore(technically called document-store/ Amazon's version of MongoDB).

advantages

When a document is written to DynamoDB table and receives an HTTP 200 response, all copies of the document are updated. The document will eventually be consistent across all storage locations, usually within one second or less.

When you request a strongly consistent read, DynamoDB returns a response with the most up-to-date data, reflecting the updates from all prior write operations that were successful. A strongly consistent read might not be available in the case of a network delay or outage.

But has some limitations,

  • only supports max 40K writes for 1KB sized documents/sec per table = which would be 400 writes for 100K sized docs/sec (in us-east region)

    supports only 10K writes for 1KB sized docs/per table in other regions

  • max 40K reads for 4KB sized documents/sec per table (in us-east region)

    supports only 10K reads for 4KB sized docs/per table in other regions

    so calculate your throughput based on your average document size and see DynamoDB fits in

  • the max document/item size in dynamodb is 400KB (reference to s3 might do the trick if document size is more than 400KB, but still depends if you really want to go that route )/ MongoDB might be alternative which allows upto 16M of document.

  • you can only fetch 1000 KB of documents from DynamoDB in one request

So, basically,

  • desired throughput,
  • ACID-compliancy (DynamoDB +1),
  • each document size (elasticsearch +1, MongoDB +1 ) and
  • security might be the deciding factor.

I would also consider looking into MongoDB vs DynamoDB as MongoDB is open source, has all the features other than A in Atomicity, and is also supported by AWS.

prayagupa
  • 30,204
  • 14
  • 155
  • 192
  • 3
    "no atomic writes" is somewhere between misleading and wrong. [Partial updates](https://www.elastic.co/guide/en/elasticsearch/guide/current/partial-updates.html) might be a bit trickier than you'd expect, but possible in most scenarios. Also I find the conclusion a little unexpected: Advantages and disadvantages of Elasticsearch and DynamoDB — use MongoDB. – xeraa Jun 06 '17 at 22:00
  • AWS provides one-click configuration of streaming Dynamodb data to an elasticsearch cluster . Disadvabtage of this feature is that the elastic search is not locked to a vpc – Srini Sydney Jun 06 '17 at 22:13
  • 2
    @xeraa Did not know my english is that bad :) I was not saying to use MongoDB at all, I'm simply saying I will also consider looking into MongoDB as well which is a document-store too with pretty much all Dynamodb has but not vendor locked like Amazon. I'm also saying do the throughput tests/ if the datastore meets document size criteria you are looking for and security to choose which one suits best. Thanks for pointing out "no atomic writes" in elasticsearch, as my answer was wrong to say that. I was supposed to Atomicity not Atomic, sorry abt that. And again thank for pointing that out :) – prayagupa Jun 07 '17 at 00:32
  • Small addition, DynamoDB now has on-demand configuration, with a higher price per operation than provisioned, but then you pay for what you use only - IMHO best for POC or when you're not sure what will be the load. – Kaplan Ilya May 04 '19 at 20:00
  • has this been updated to match the AWS-supported resource for ElasticSearch? – nate May 28 '21 at 20:53
  • Mongo DB is nowhere near as scalable as dynamo, the real answer is really scalability. If you want almost infinite scalability dynamo is the way to go. Also, the 40k reads/writes per table is not an actual limit. These are simply initial quotas so you don't accidentally spend a million dollars, but can easily be adjusted up as much as you need. – Daniel Tabuenca Sep 16 '22 at 05:24