2

I am trying to design an index that can respond to my access pattern. In the UI, I have one collection that can be filtered by 4 attributes:

  • customer
  • date
  • type
  • creditor

I was reading the documentation and Alex Debrie's book, and I was inclined to use the Composite Sort Key strategy for filtering. Even though, I have a problem: I can filter my data combining any of these attributes. For example:

  • I can only fill the customer and date filter
  • Or just select type as a filter
  • Or just select date as a filter
  • etc (All combination of filters)

If I had the 4 filters, I would just use the pattern date#type#customer#creditor and it would work. But how can I design these indexes in order to have the flexibility of multiple filters, but not all of them are needed.

Thanks

Juan Rivillas
  • 897
  • 2
  • 9
  • 23
  • I'm confused. If you use `date#type#customer#creditor` as a composite sort key, how would you filter bu type? – jellycsc Jul 14 '20 at 14:38
  • @jellycsc That combination will work if and only if the 4 attributes are required. This is exactly my main point and biggest problem, thus, it doesn't work for me. I want to know how to do that :) – Juan Rivillas Jul 14 '20 at 14:45
  • 1
    Ok, i see. In general, ddb is not good at this type of work. But it can still achieve it if you create a GSI for each of your filter. – jellycsc Jul 14 '20 at 14:49
  • I see! Hum. I feared that I would need to do that. Thanks for the input – Juan Rivillas Jul 14 '20 at 19:07

0 Answers0