title: How can I query DynamoDB with sort and limit for a non sort key parameter?
body: <p>I'm trying to create a simple "scoreboard" using DynamoDB and API Gateway. I can pull straight from Dynamo just fine, but I want to only show the top 10 rows. Basically, API Gateway should only return the top 10 scores. The database uses a shared value for its partitionkey to return everything. I set the sorting key to a timestamp to make sure each row is unique. The other two columns are "nickname" and "score". I'd like to be able to just pull the top 10 rows based on the score column. Any ideas? </p>
  
  <p>This is my mapping template:</p>
  
  <pre><code>{
      "TableName": "pacman",
      "KeyConditionExpression": "entire = :v1 AND recordTime &gt; :v2",
      "ExpressionAttributeValues": {
          ":v1": {
              "S": "$input.params('entire')"
          },
          ":v2": {
              "S": "$input.params('recordTime')"
          }
      }
  }
  </code></pre>
  
  <p>Right now, it successfully returns all rows in my table.</p>