Skip to main content

Upsert Edges using UpsertE  

Create new edges or update existing ones with insert-or-update semantics.
UpsertE is a traversal step that operates on an existing traversal context. The type comes from the preceding traversal (E<Type>), not from the upsert call itself. If an edge already exists between the specified nodes, it is updated; if no edge is found, a new edge is created.
Edge connections (::From() and ::To()) are required for UpsertE. The order of From and To is flexible. Properties are also required.

Example 1: Basic edge upsert with properties

Here’s how to run the query using the SDKs or curl

Example 2: Upsert edge with multiple properties

Here’s how to run the query using the SDKs or curl

Example 3: Flexible From/To ordering

The ::From() and ::To() can be specified in either order.

How Upsert differs from Add

When updating, UpsertE merges properties: it updates specified properties while preserving any existing properties that aren’t included in the upsert.