title: Inconsistent results with query/scan DynamoDB - NodeJS
body: <p>I have a DynamoDB table that looks like this:</p>
  <p><a href="https://i.stack.imgur.com/q6a7c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q6a7c.png" alt="enter image description here" /></a></p>
  <p>(there are like 1500000 entries like this one with different timestamps)</p>
  <p>I have 2 GSI:</p>
  <p><a href="https://i.stack.imgur.com/eEhTs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eEhTs.png" alt="enter image description here" /></a></p>
  <p>I'm trying to retrieve all the rows in the table for a given day.</p>
  <p>This is what my code looks like (NodeJS):</p>
  <pre><code>var AWS = require(&quot;aws-sdk&quot;);
  
  AWS.config.update({accessKeyId: &quot;&quot;, secretAccessKey: &quot;&quot;});
  AWS.config.update({region: 'us-east-1'});
  
  var docClient = new AWS.DynamoDB.DocumentClient();
  
  var params = {
      TableName: &quot;QfGamingTransactionsProd&quot;,
      IndexName: 'Result-RedeemedAt-index',
      KeyConditionExpression: &quot;#rs = :result and begins_with (#rat, :Rat)&quot;,
      ExpressionAttributeNames: {
          &quot;#rs&quot;: &quot;Result&quot;,
          &quot;#rat&quot;: &quot;RedeemedAt&quot;
      },
      ExpressionAttributeValues: {
          &quot;:result&quot;: &quot;SUCCESS&quot;,
          &quot;:Rat&quot;: &quot;2016-10-20&quot;
      }
  };
  
  docClient.query(params, function (err, data) {
      if (err) {
          console.error(&quot;Unable to query. Error:&quot;, JSON.stringify(err, null, 2));
      } else {
          console.log(&quot;\nQuery succeeded. \n&quot;);
          console.log(&quot;- Total&quot;, data.Count);
      }
  });
  </code></pre>
  <p>It seems to be working, but i'm getting (way) less results than expected. This same code works fine on a smaller Table.</p>
  <p>Similar results with &quot;Scan&quot;.</p>
  <p>What am I missing?</p>