-1

I have a flat table with around 30 attributes in DynamoDB. I would like to expose an API for my end users/applications to query on a random combination of those attributes.

This is trivial to do in a typical RDBMS.

How can we do this in DynamoDB? What kind of modelling techniques and/or Key condition expressions can we use to achieve this.

gudvred
  • 1
  • 3

1 Answers1

1

Multi-faceted search like you describe can be challenging in DynamoDB. It can certainly be done, but you may be fighting the tool depending on your specific access patterns. Search in DynamoDB is supported through query (fast and cheap) and scan (slower and expensive) operations. You may want to take some time to read the docs to understand how each works, and why it's critical to structure your data to support your access patterns.

One options is to use ElasticSearch. DynamoDB Streams can be used to keep the ElasticSearch index updated when an operation happens in DynamoDb. There are even AWS docs on this particular setup.

Seth Geoghegan
  • 5,372
  • 2
  • 8
  • 23
  • Thanks for the reply Seth. Yeah, I tried all possibilities and I just could not get how this could be implemented for a more generic search implemented that don't have a defined access pattern. I went through all the examples listed in "The DynamoDB Book" but i could not any of those patterns to a multifaceted search. – gudvred Sep 01 '20 at 23:17
  • That's a great book, you've working with a fantastic resource! I came to the same conclusion while trying to implement a similar access pattern. Unfortunately, it's just not one of Dynamo's strong suits. – Seth Geoghegan Sep 01 '20 at 23:33
  • Thanks for the clarification. I am looking to only use serverless products and AWS ElasticSearch is not serverless. So was wondering what other serverless product I can use as a search engine for the data in DynamoDB. I looked at Athena but it does not provide sub second response times and so cannot use it with an API. The other serverless option is Kinesis Streams. But not sure if i can run search queries and get sub second response times. Any thoughts? – gudvred Sep 03 '20 at 02:03