I have a table of items where each item belongs to an organization. Each item has a name and an auto-generated UUID. The name of the item is meant to be unique within an organization. Thus, I have defined my table as such:
{
  "AttributeDefinitions": [
    { "AttributeName": "EmpId",            "AttributeType": "ABC" },
    { "AttributeName": "name",             "AttributeType": "ABC" },
    { "AttributeName": "id",               "AttributeType": "ABC" }
  ],
  "TableName": "symbols",
  "KeySchema": [
    { "AttributeName": "EmpId", "KeyType": "HASH" },
    { "AttributeName": "name",  "KeyType": "RANGE" }
  ],
  "LocalSecondaryIndexes": [
    {
      "IndexName": "IdIndex",
      "KeySchema": [
        { "AttributeName": "EmpId", "KeyType": "HASH" },
        { "AttributeName": "id",    "KeyType": "RANGE" }
      ],
      "Projection": {
        "ProjectionType": "KEYS_ONLY"
      }
    }
  ],
  "ProvisionedThroughput": {
    "ReadCapacityUnits": 10,
    "WriteCapacityUnits": 5
  },
  "SSESpecification": {
    "Enabled": true
  }
}
I am trying to retrieve the set of items that match a specified list of ids. My java code looks like this:
List<AttributeValue> attributeValueList = new ArrayList<>();
String[] idList = {"XXXXXX5-4ec2-95a9-XXXXXXX", "YYYYYYYY-9a55-4c2c-b329-YYYYYYYYYYY"};
for (String id : idList) {
    attributeValueList.add(new AttributeValue().withS(id));
}
HashMap<String, Condition> keyConditions = new HashMap<>();
keyConditions.put("orgId", new Condition()
        .withComparisonOperator(ComparisonOperator.EQ)
        .withAttributeValueList(new AttributeValue("111")));
keyConditions.put("id", new Condition()
        .withComparisonOperator(ComparisonOperator.IN)
        .withAttributeValueList(attributeValueList));
QueryRequest queryRequest = new QueryRequest()
        .withTableName(Symbol.TABLE_SYMBOL)
        .withKeyConditions(keyConditions)
        .withIndexName("IdIndex")
        .withSelect("ALL_ATTRIBUTES");
QueryResult queryResult = dynamoDB.query(queryRequest);
When I run the query, it gives me the exception:
Attempted conditional constraint is not an indexable operation
Why this doesn't work?
Do I need to use a scan instead?
I want a query if possible.