title: AWS Dynamodb: Is it possible to make a query only using sort key
body: <p><a href="https://i.stack.imgur.com/9IPZQ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/9IPZQ.jpg" alt="enter image description here"></a></p>
  
  <p>Hi dynamodb community,</p>
  
  <p>So the table in question is MLA_USER_AUTH. As you see it has  as partition key and  as sort key. I want to be able to query the database using both user_id and email. </p>
  
  <p>Sometimes I need to find the user associated with the email and sometimes the userid. Both email and userid attributes are unique for every visitor. is there any way it can be done?</p>
  
  <p>This is my current query. This obviously doesnt work. As it throws the error: ValidationException: Query condition missed key schema element: UserID</p>
  
  <pre><code>var params = {
          TableName : 'MLA_USER_AUTH',
          KeyConditionExpression: "Email = :email",
          ExpressionAttributeValues:{
              ":email": { "S" : email } 
          }
      };
      dynamodb.query(params, function(err, data) { 
  </code></pre>
  
  <p>Are GSIs my only option. Any help appreciated</p>
  
  <p>Thanks,
  Ninjasoar   </p>