I started using Amazon DynamoDB and have an issue with query.
I have a table Dev_Testgame1_Mail with id as primary hash key and following three global secondary indexes,
- fromPlayerId (Hash Key)
- toPlayerId (Hash Key) + isRead (Range Key)
- toPlayerId (Hash Key) + endDate(Range Key)
I have above code to do the query,
**DynamoDBMail hashKObject = new DynamoDBMail();
hashKObject.setToPlayerId(playerId);
Condition endDateRangeKeyCondition = new Condition();
//endDateRangeKeyCondition.withComparisonOperator(ComparisonOperator.NULL).withAttributeValueList(new AttributeValue().withB(Utils.convertDateToByteBuffer(DateUtil.getUtcDateTime())));
endDateRangeKeyCondition.withComparisonOperator(ComparisonOperator.NULL);
DynamoDBQueryExpression<DynamoDBMail> queryExpression = new DynamoDBQueryExpression<DynamoDBMail>();
queryExpression.withHashKeyValues(hashKObject).withRangeKeyCondition("endDate", endDateRangeKeyCondition);
queryExpression.withIndexName("gsi_tp_enddt").withLimit(pageSize).withScanIndexForward(false);
return dynamodbMapper.queryPage(DynamoDBMail.class, queryExpression, new DynamoDBMapperConfig(TableNameOverride.withTableNamePrefix(Utils.getDynamoDBTableNamePrefix(gameId, env))));**
And I get the following error,
com.amazonaws.AmazonServiceException: Status Code: 400, AWS Service: AmazonDynamoDBv2, AWS Request ID: GUUBV24K2O40T276R9NNN0EKB7VV4KQNSO5AEMVJF66Q9ASUAAJG, AWS Error Code: ValidationException, AWS Error Message: Consistent reads are not supported on global secondary indexes
Your help is much appreciated on this issue.
Thanks Arun