I would like to specify. May I receive elements only from DynamoDBIndexHashKey
, not use DynamoDBHashKey
?
I have a table with fields
@DynamoDBIndexHashKey (attributeName = "count", globalSecondaryIndexName = "count-index")
@DynamoDBHashKey(attributeName="cluster_output_Id)"
@DynamoDBRangeKey(attributeName="last_fetch)"
I have no @DynamoDBIndexRangeKey
It's code:
MyEntity myEntity = new MyEntity();
myEntity.setCount(1); // Integer
DynamoDBQueryExpression<NewsDynamoDb> queryExpression = new DynamoDBQueryExpression<NewsDynamoDb>()
.withHashKeyValues(myEntity)
.withIndexName("count-index");
queryExpression.setConsistentRead(false);
List<MyEntity> myCollection = mapper.query(MyEntity.class, queryExpression);
Error:
AmazonServiceException: Status Code: 400, AWS Service: AmazonDynamoDBv2, AWS Request ID: I97S04LDGO6FSF56OCJ8S3K167VV4KQNSO5AEMVJF66Q9ASUAAJG, AWS Error Code: ValidationException, AWS Error Message: One or more parameter values were invalid: Invalid number of argument(s) for the EQ ComparisonOperator
How I can get items from DynamoDBIndexHashKey
?
P.s. Scan - work but not interesting to me, because in a further I want a sorting Query with DynamoDBHashKey work. I have problems with DynamoDBIndexHashKey