title: DynamoDB query table for two indexed fields
body: <p>In my dynamoDB table I have two fields which I intend to query for a specific value. One will returns several results, the second will return one result (aka one row).</p>
  
  <p>I already have a range key field which is the date that the raw inserted.</p>
  
  <p>What are my options if I want to have two fields to query by a single field?</p>
  
  <p>From my understanding, there is an option to create a secondary index, but I must query it alongside with the hash key, which is not what I need. Is there any option to achieve that in a single table instead of creating a second table for that query?</p>
  
  <p>Example Folders table:</p>
  
  <pre><code> user_id (hash key)    
   date_created (range key)    
   folder_id
  </code></pre>
  
  <p><strong>First query</strong>: Select all folders Id's for a specific user order by date descending</p>
  
  <p><strong>Second query</strong>: Select single raw for a specific folder_id</p>
  
  <p>If I use secondary index on the folder_id, I will have to query it alongside the user_id (hash key), which is as you can see, not what I want to achieve.</p>
  
  <p>Thanks.</p>