Upsert with multiple UIDs

One question, why your query is like that and not like this?

{
  getVals(func: has(products)) @normalize {
    productsUid : uid
  	products @filter(eq(productId, 19610626)) {
      productUid : uid
      options @filter(eq(optionId, 32661491)) {
        optionUid : uid
      }
    }
  }
}

It must have a list of defined variables and used but undefined.

UPDATE:

 Map<String, String> map = new HashMap<String, String>();
            map.put("$productID", inputMessage.getProductId().toString());
            map.put("$optionID", inputMessage.getOptionId().toString());

            for (Map.Entry<String, String> entry : map.entrySet()) {
                query = query.replace(entry.getKey(), entry.getValue());
            }

I don’t know Java, but I think something is wrong here. Why are you mapping this and doing a loop?

I doesn’t looks like this GitHub - dgraph-io/dgraph4j: Official Dgraph Java client

Also, you don’t need to use normalize in an upsert block. There’s no reason for this. You will not receive responses from this transaction. Only logs as response.