Search code examples
amazon-dynamodbdynamodb-queries

Can I index and query against a field that holds a collection of values in Amazon's DynamoDB?


Is this type of indexed query available in Amazon's DynamoDB?

(Where the field being searched against is a collection of values?)

Example object being indexed:

Restaurant: {
     name: 'Bobs Burgers'
     menu: ['hamburger', 'hotdog', 'lasagna']
}

Example pseudo-query:

SELECT * FROM restaurants WHERE menu='hamburger'
( or perhaps: 'hamburger' in menu )

Also:

  • What is this type of index called? Its been a while since I worked with this kind of thing and I have forgotten some of the correct verbiage.
  • What is a good place to get a primer on what types of queries are possible with DynamoDB?

Solution

  • There is no index to find a value in a list. You can use a filter, but it won't be index-optimized. See How to query DynamoDB filtering by value in a list

    Alex DeBrie's YouTube channel has videos on getting started with DynamoDB: https://www.youtube.com/channel/UC8uIi5eIEI2_NZGTyPXTnLA