My DynamoDB Query is returning "Query key condition not supported".
NSMutableDictionary * conditions = [[NSMutableDictionary alloc] init];
DynamoDBCondition * googleConditionLat = [[DynamoDBCondition alloc] init];
googleConditionLat.comparisonOperator = @"BETWEEN";
DynamoDBAttributeValue * googleIDAttributeLat1 = [[DynamoDBAttributeValue alloc] initWithN:[NSString stringWithFormat:@"%f", location.coordinate.latitude - 0.0005]];
[googleConditionLat addAttributeValueList:googleIDAttributeLat1];
DynamoDBAttributeValue * googleIDAttributeLat2 = [[DynamoDBAttributeValue alloc] initWithN:[NSString stringWithFormat:@"%f", location.coordinate.latitude + 0.0005]];
[googleConditionLat addAttributeValueList:googleIDAttributeLat2];
[conditions setObject:googleConditionLat forKey:kLatitudeKey];
#if 1
DynamoDBCondition * googleConditionLong = [[DynamoDBCondition alloc] init];
googleConditionLong.comparisonOperator = @"BETWEEN";
DynamoDBAttributeValue * googleIDAttributeLong1 = [[DynamoDBAttributeValue alloc] initWithN:[NSString stringWithFormat:@"%f", location.coordinate.longitude - 0.0005]];
[googleConditionLong addAttributeValueList:googleIDAttributeLong1];
DynamoDBAttributeValue * googleIDAttributeLong2 = [[DynamoDBAttributeValue alloc] initWithN:[NSString stringWithFormat:@"%f", location.coordinate.longitude + 0.0005]];
[googleConditionLong addAttributeValueList:googleIDAttributeLong2];
[conditions setObject:googleConditionLong forKey:kLongitudeKey];
#endif
NSMutableDictionary *queryStartKey = [[NSMutableDictionary alloc] init];;
do
{
DynamoDBQueryRequest *queryRequest = [[DynamoDBQueryRequest alloc] init];
queryRequest.tableName = PLACE_TABLE_NAME;
queryRequest.exclusiveStartKey = queryStartKey;
queryRequest.keyConditions = conditions;
queryRequest.consistentRead = false;
queryRequest.indexName = @"lat-long-global-index";
@try
{
DynamoDBQueryResponse *queryResponse = [[AmazonClientManager ddb] query:queryRequest];
My global secondary index is:
Index Name: lat-long-global-index Hash Key:lat (Number) Range Key:long (Number)
I have a very similar query on a GSI to the same table with one string hash key using "EQ" which works fine.
Any thoughts appreciated...