Expand(_all_) doesn't work with facets

I Want to Do

I’d like to query for all predicates including their facets

What I Did

The schema related to this issue is described here. All the stored nodes have appropriate DTypes assigned.

I use the following query to return all predicates including DType:

{
  q(func: has(xid)) {
    expand(_all_) {
        expand(_all_)
    }
    dgraph.type
  }
}

This works perfectly fine (and returns the facets), the problem is when I try to explicitly request facets, too:

{
  q(func: has(xid)) {
    expand(_all_) @facets {
        expand(_all_)
    }
    dgraph.type
  }
}

This fails with the following error:

{
  "name": "t",
  "url": "http://localhost:8080/query?timeout=20s",
  "errors": [
    {
      "message": "line 3 column 19: expand is only compatible with type filters",
      "extensions": {
        "code": "ErrorInvalidRequest"
      }
    }
  ]
}

Based on the returned error description I gather I can not query for @facets using expand?

I did find the following bug, but it does seem it fixes a different issue to the one I’m experiencing here, though the fix in the referred GH issue is quite old so things may have changed since then.

Is there any way I can ask for @facets with expand(_all_) query?

Dgraph Metadata

dgraph version
$ dgraph version
[Decoder]: Using assembly version of decoder
Page Size: 4096

Dgraph version   : v20.11.0
Dgraph codename  : tchalla
Dgraph SHA-256   : 8acb886b24556691d7d74929817a4ac7d9db76bb8b77de00f44650931a16b6ac
Commit SHA-1     : c4245ad55
Commit timestamp : 2020-12-16 15:55:40 +0530
Branch           : HEAD
Go version       : go1.15.5
jemalloc enabled : true

For Dgraph official documentation, visit https://dgraph.io/docs/.
For discussions about Dgraph     , visit https://discuss.dgraph.io.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2020 Dgraph Labs, Inc.

That looks like a feature request. But also looks like it was supported in the past… Curious.

1 Like