Are you sure that you using this query?
{
parents(func: has(isParent)) {
uid
name
items {
itemAmount as amount
}
total: sum(val(itemAmount))
}
}
For me is working:
{
"extensions": {
"server_latency": {
"parsing_ns": 30061,
"processing_ns": 2596369,
"encoding_ns": 881382
},
"txn": {
"start_ts": 16578
}
},
"data": {
"parents": [
{
"uid": "0x3f7d",
"name": "third"
},
{
"uid": "0x3f7e",
"name": "first",
"items": [
{
"amount": 10
},
{
"amount": 2
}
],
"total": 12
},
{
"uid": "0x3f81",
"name": "second",
"items": [
{
"amount": 5
},
{
"amount": 3
}
],
"total": 8
},
{
"uid": "0x3f84",
"name": "first",
"items": [
{
"amount": 0
}
],
"total": 0
},
{
"uid": "0x3f86",
"name": "first"
}
]
}
}
I’ve also did a test with:
{
"set": [
{
"uid": "_:first",
"isParent": true,
"name": "first",
"items": [
{ "amount": 0 }
]
}
]
}
Some func or indexes need at least a value. Like “0”.
Tested in:
Dgraph version : v1.0.12
Commit SHA-1 : 60d9ef0a
Commit timestamp : 2019-03-05 17:59:30 -0800
Branch : HEAD
Go version : go1.11.5