0
votes

Is it possible to get the items from DynamoDB table by querying against any attribute of the table except the primary key? In my table I have product ID as the Hash key and I have not specified any Range key. I want to add support for filters based on various attributes such as product price, product brand, available units in stock etc. And while filtering I do not want to provide the product ID since in most of the cases I may not know the product ID. Coming from a SQL background I was assuming DynamoDB to also have some sort of 'where' clause to list records that match certain criteria/value of attribute(s). However, so far I haven't had success.

After going through the Query and Scan documentation also,I couldn't figure out how I can optimally use these operations to suit my needs. And how can I perform search/filter in my application without burning through my provisioned throughput capacity.

Any ideas as to how this can be done?

1

1 Answers

1
votes

Create a Global Secondary Index on the attributes you want to query on. It will have its own capacity in both read and write units as well as other considerations. If you need to add indices to an existing table, AWS preannounced Online Indexing a couple months ago so look forward to hearing more news on when that is released. If you need more than just simple queries against these indices (EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN) you may want to consider using an search solution, such as AWS Cloud Search