Linking Entities Together
What You’ll Learn
In this section, you will learn:
- When to link entities together
- How to link entities together
- Important considerations around linking entities
Part of the power of the Knowledge Graph is relating entities together. This can be done via the Entity List custom field type. Relationships in Yext have 3 properties:
- The source Entity
- The pointer Entity
- The relationship context (the field)
For example, if we wanted to say that Products are available at specific Locations, we could create a field called “Available at” on the Product type. We can use custom field validation to limit what type of entities can be the “pointer Entity”. In this case, we would limit it to just Locations. Once the field is created, we would update each Product entity to point to a location or set of locations on the “Available at” field.
Once a relationship exists, you can see the relationship contexts and navigate to the Pointer Entities using the Linked Entities Module on Entity Edit. This module will list all relationships organized by Entity Type and Field, including when that entity is either the Source Entity or the Pointer Entity (i.e., another entity is pointing to it). The arrow indicates the relationship direction – if the arrow is pointing to the right, the entity you are on is the Source Entity and is pointing to other entities. If the arrow is pointing to the left, the entity you are on is one of the Pointer Entities and another entity is pointing to it. You can view the count of entities that the entity you are on is related to, or you can click on the field name to view the list of entities related.
Here’s a video showing how we would create this field and update an entity:
Common Use Cases
There are many reasons to want to link entities together. For example:
Pull in data from linked entities for Pages (e.g., feature doctor headshots on a facility page or featured menu items on a restaurant page).
Relate entities together to answer questions (e.g., “where does Dr. Sara work?” or “what offices have open job positions”)
Filter related entity names in Answers (like condition names for Healthcare Professionals for queries like “doctors who treat back pain”)
Organize your data for easier management (e.g., bulk editing)
Updating Linked Entity Fields
You can update the linked entity fields just like any other field! You can use the platform for single or bulk edit and we will display an easy-to-search UI for selecting the related entities. You can also use Entity Upload or use the API to update these fields – all you’ll need is the Entity ID (unique identifier) of the related entities.
While this feature is very powerful, there are a few things to keep in mind when working with Linked Entities:
These relationships are one-way (as in are only set from one entity). In most cases, this should be sufficient to pull the data you need
You can use Validation to determine what types of entities can be linked (e.g., if you only want users to be able to select the Location type entity). In the video above, you’ll see that we added validation so that only Location-type entities were selectable.
You can use Validation on the item count to limit the number of relatable entities (1 to unlimited).
For Answers, you can only use the related entity’s name for filters or indexing. You cannot use other related data at this time.