Defining relationship types
The ability to add relationship types is in public beta. Please reach out to Cortex Customer Engineering with any feedback.
Relationship types allow you to define, manage, and visualize relationships between entities within your Cortex workspace, ensuring your organization's structures and dependencies are accurately represented.
Understanding relationship types in Cortex
A relationship type defines how two entities relate to either other, and constrains the types of entities that can be the source and destination entities within the relationship.
Cortex provides multiple options for defining a relationship:
Entity relationship: As described on this page, you can customize a relationship type (hierarchical or cyclical) between any entity type.
Domain hierarchy: You can define a hierarchical relationship between domain entities. You can also configure inheritance; the owner of an entity can be inherited from entities higher in the domain hierarchy. Learn more in Add domains.
Dependencies: You can define a cyclical relationship between non-team entities. Learn more in Defining dependencies.
Want to learn more? Check out the Cortex Academy course on Catalogs, Entities, and Relationships, available to all Cortex customers and POVs.
Common use cases of custom relationship types
Repository
Mapping services to repositories to view the hierarchy of repos and the services they contain. For example, a service is linked to its code repository.
Service
Repository
Cloud account to resource
Associating cloud accounts (like AWS, Google Cloud Project, or Azure subscription) with their respective resources (such as EC2 instances or other cloud resources).
AWS account
GCP
Azure subscription
AWS resources (e.g., EC2)
Google Cloud resources
Azure resources
Service to environment
Linking services to their deployment environments.
Service
Environment
Monorepo
Mapping multiple services to a single repository.
Repository
Service
Service to endpoint
Associating services with their endpoints.
Service
Endpoint
Data center modeling
epresenting data centers and their relationships to other infrastructure components.
Data center
Component
Note that you should not create custom relationship types to represent ownership; teams can be designated as owners of entities.
View relationship types
View all configured relationship types
To view all relationship types, go to Catalogs > All entities then click the Relationship types tab.

To view the details of a specific relationship type, click its name from the list.
View relationships on entity pages
If an entity belongs to a relationship, you can explore that context directly from its entity details page. Select Relationships in the left sidebar to see all relationship types associated with the entity.
In the example below, the entity California belongs to a relationship called Geography . Relationships default to a Graph view, giving you a visual map of parent/child connections.

From the graph, click any entity to view a quick summary of its metadata. Select Go to entity to navigate directly to that entity's detail page.

Toggle to Table view to see the same data in a structured list. useful for quickly scanning or sorting related entities.

Manage relationship types
Create relationship types and relationship connections
Create relationship types in the Cortex UI
Navigate to Catalogs > All entities then click the Relationship types tab.
In the upper right corner, click Create > Create new relationship type. \

Configure the details and entity types:
Name: Enter a name for the relationship type.
Identifier: Enter a unique identifier, used to specify this relationship in YAML definitions for this relationship type.
Description: Add a description of the relationship to help others understand its purpose.
Create relationship type catalog: Enable this option to create a catalog for this relationship type.
Source entity types: Search for and select the entity types which will be the source for this relationship. Selecting no entity type means that all entity types are available as sources.
You can also customize the singular and plural wording of the entity types and the cardinality.
Destination entity types: Search for and select the entity types which will be the destination for this relationship. Selecting no entity type means that all entity types are available as destinations.
You can also customize the singular and plural wording of the entity types and the cardinality.
Configure the relationship constraints:
Architecture: If you are configuring hierarchical data, such as an org chart, we recommend choosing Acyclical. If you are configuring graph-like data, such as dependencies, we recommend choosing Cyclical.
Definition location: Configure where relationships can be defined — from destination entities, from source entities, or from either.
Configure metadata inheritance.
Enable the Ownership toggle to configure inheritance for the relationship type, then select how metadata will be inherited:
Fallback: This option uses the source's data only if the destination does not have anything defined.
Append: This option appends the source's data to the destination, even if it already has data defined.
Learn more about inheritance in Defining ownership.
Click Create.
Create relationship connections between entities in the UI
After creating the relationship type, you can configure connections between entities in a relationship. You can do this via the entity descriptor or in the UI, as described below:
Navigate to an entity details page. In the upper right corner, click Configure entity.
Click the Relationships link on the left.
At the top of the Relationship Type section, click the dropdown to select which relationship type you are configuring connections for.\

After selecting the relationship type, you can search for and select entities in the Sources dropdown and in the Destinations dropdown.

At the bottom of the page, click Save changes.
Create relationship connections between entities in the entity descriptor
Relationship types must be created in the Cortex UI or via the API. Once a relationship type exists, you can define the connection in either the source or destination entity's YAML using the x-cortex-relationships tag.
In the example below, a source entity's YAML has a defined relationship type called app-components and has destination entities production-ui and backend-app.
Optionally, this can be configured in the YAML of the destination by replacing source with destination in the YAML above.
The relationship between entities in Cortex is based on the relationship being defined in the entity's YAML file; Cortex does not set hierarchies or relationships based on a YAML file's location in your repository.
Create relationship types via the API
You can create, update, and delete relationship types using the Cortex API.
Create relationship connections between entities via the API
You can create, update, and delete relationships between entities using the Cortex API.
Edit relationship types
Edit relationship type
To edit an existing relationship type:
Navigate to Catalogs > All entities then click the Relationship types tab.
In the row containing the relationship type, click the pen icon.

Make any necessary changes, then at the bottom of the page, click Save.
Delete relationship types
Delete relationship types
Navigate to Catalogs > All entities then click the Relationship types tab.
Click the relationship type name.
On its details page, in the upper right corner, click Remove.

Entity relationship CQL
You can create Scorecard rules and write CQL queries based on entity relationships.
See more examples in the CQL Explorer in Cortex.
Entity relationship destinations
All recursive destinations an entity for a relationship type, with an optional depth parameter to expand results
Definition: entity.destinations(relationshipType = "my-relationship")
Examples
You could write a Scorecard rule to ensure that an entity has at least one destination with the "my-relationship" type:
Entity relationship sources
All recursive sources an entity for a relationship type, with an optional depth parameter to expand results
Definition: entity.sources(relationshipType = "my-relationship")
Examples
You could write a Scorecard rule that ensures an entity has at least one source with the "my-relationship" type:
Last updated
Was this helpful?