amazon dynamodb - AWS Error Code: ValidationException, AWS Error Message: Consistent reads are not supported on global secondary indexes -
i started using amazon dynamodb , have issue query.
i have table dev_testgame1_mail id primary hash key , following 3 global secondary indexes,
- fromplayerid (hash key)
- toplayerid (hash key) + isread (range key)
- toplayerid (hash key) + enddate(range key)
i have above code 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 following error,
com.amazonaws.amazonserviceexception: status code: 400, aws service: amazondynamodbv2, aws request id: guubv24k2o40t276r9nnn0ekb7vv4kqnso5aemvjf66q9asuaajg, aws error code: validationexception, aws error message: consistent reads not supported on global secondary indexes
your appreciated on issue.
thanks arun
set consistent read property of queryexpression
false
. put line:
queryexpression.withconsistentread(false);
or
queryexpression.setconsistentread(false);
before call
return dynamodbmapper.querypage(dynamodbmail.class, queryexpression, new dynamodbmapperconfig(tablenameoverride.withtablenameprefix(utils.getdynamodbtablenameprefix(gameid, env))));
as aside, don't think null
rangekeycondition
doing you.
Comments
Post a Comment