found very weird but working workaround. it uses edge with facets, filtering on facets doesn’t require index and is not performing redundant and slow lookups. the edge is pointing from node to itself (since filtering on value edge facets is not supported):
entity_key: string @index(exact) .
_:node <entity_key> "entity1" .
_:node <attrs> _:node (name="Nikita", sex="m") .
{
get_entity(func: eq(entity_key, "entity1")) @cascade {
uid
attrs @facets(eq(name, "Nikita") and eq(sex, "m")) @facets(name, sex) # male
}
}
{
"data": {
"get_entity": [
{
"uid": "0x1",
"attrs": [
{
"attrs|name": "Nikita",
"attrs|sex": "m"
}
]
}
]
}
}
{
get_entity(func: eq(entity_key, "entity1")) @cascade {
uid
attrs @facets(eq(name, "Nikita") and eq(sex, "f")) @facets(name, sex) # female now
}
}
{
"data": {
"get_entity": []
}
}
btw, seems like it’s not so hard to implement filtering by edge values since it’s already done for edge facet values.