Facet types

Hey everyone. Disclaimer - I’m a dgraph noob here so please go easy.

I was wondering if there’s a way to define the ‘type’ of an edge ‘facet’ and perhaps index it in a similar way that we do for predicates in the schema. Any thoughts on this.

Another related question. Can an edge facet be a list type?

Hi,
Think of facets as a little piece of metadata you can attach to a single value. So, if your triple is part of a list type, each value in the list can have each facet once (by name). Read more about facets on lists here.

Facets cannot be indexed, they will always be a value lookup to access/filter by.

Facet types are guessed from the RDF input based on their format(eg: false is a bool type, "mything" is a string, etc. code that does this is here). However in using the gRPC api they can be set explicitly (eg: dgo)

Make sure you read up on facets in general here. Strongly consider the warning:

Though you may find yourself leaning towards facets many times, they should not be misused…

1 Like

Thanks for the advice. I’m driving this with the python API which I believe uses gRPC. I need to set a couple of facets as datetime.

I think I need to read a bit more carefully on what facets can and can’t be used for. Thanks again