If you happen to know the HashKey
value, another option would be to use QUERY and a FilterExpression. Here is an example with the Java SDK:
Table table = dynamoDB.getTable(tableName);
Map<String, Object> expressionAttributeValues = new HashMap<String, Object>();
expressionAttributeValues.put(":x", "no");
expressionAttributeValues.put(":y", "no");
QuerySpec spec = new QuerySpec()
.withHashKey("HashKeyAttributeName", "HashKeyValueHere")
.withFilterExpression("attribute1 = :x or attribute2 = :y")
.withValueMap(expressionAttributeValues);
ItemCollection<QueryOutcome> items = table.query(spec);
Iterator<Item> iterator = items.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next().toJSONPretty());
}
See Specifying Conditions with Condition Expressions for more details.