Skip to content

ChangeStreamService ​

CE Change Data Capture: the committed changes of a shard as logical events, streamed from its Raft log via gRPC server-side streaming.

Each committed transaction is a unit; each of its effects is an event: a put, patch or removal of a node, a relationship's presence, its properties, or one version or discriminated instance of it. The client keeps an opaque cursor and reconnects with it to continue where it chose. At-least-once delivery. History is released only up to a cursor the client acknowledges with AcknowledgeSubscription.

Methods ​

Subscribe ​

Open a long-lived server-side streaming RPC that tails the Raft log.

The server streams ChangeBatch messages, each with whole units, once the serving node has applied their log entries; entries that are not committed yet are never sent. Every unit the stream passes is in a batch, one with no event the interest takes too. When caught up, the stream waits until the node applies another entry. The stream stays open until the client cancels or the connection drops.

On reconnect, pass the cursor of the last batch received to resume without gaps. Omit it to start where the registration stands: its acknowledged position, or the oldest retained entry for a new one. A cursor binds the history, the event interpretation and the interest it was read with: one of another history or interpretation, or read with another interest than the request's, is refused with INVALID_ARGUMENT.

Every stream reads as a registered consumer: the request names the consumer and either registers it with an explicit retention policy (incarnation 0) or resumes a live registration (incarnation from the first stream). The registration outlives the connection until CancelSubscription. The response's initial metadata carries the registration's incarnation as x-coordinode-consumer-incarnation.

A position the log no longer holds is refused with FAILED_PRECONDITION and ErrorInfo reason RETENTION_LOST (metadata requested_index, first_retained_index): the stream never resumes past a gap, and never jumps to the newest entry in its place. An ORDINARY consumer that gets it rebuilds its state and acknowledges a position the log holds. A registration that has ended is refused with FAILED_PRECONDITION and reason CONSUMER_TERMINATED (metadata incarnation, reason, checkpoint); registering the id again starts a new incarnation.

A unit the stream cannot project (a change recorded without the context that says what it means) fails the stream with FAILED_PRECONDITION and ErrorInfo reason CHANGE_FEED_UNSUPPORTED; the stream does not pass it.

Sending a batch is not delivery: a stream resumed without a cursor starts at the acknowledged position and re-sends what the client never acknowledged, while the log still holds it. A cursor chooses where reading starts and releases nothing.

Transport: Server-streaming gRPC only (no HTTP transcoding)

Request: SubscribeRequest

FieldTypeDescription
cursorbytesThe cursor of the last batch received. Omit to start where the registration stands.
interestChangeInterestWhat the subscription follows; with a cursor, the interest it was read with, by the names its labels were created under. A cursor keeps the labels it was read with: when one of them was dropped and its name created again, the stream still reads the dropped label, its DROP included, and not the new one.
consumer_idstringThe consumer this stream reads as: globally unique, chosen by the client. Required, non-empty and at most 65525 bytes of UTF-8; a longer id is refused with INVALID_ARGUMENT.
incarnationuint640 registers the consumer anew with retention, starting at cursor (or the oldest retained entry without one); refused with ALREADY_EXISTS while another incarnation of the id is live. Any other value resumes that live incarnation, and retention is ignored.
retentionConsumerRetentionRequired when registering (incarnation 0).

Response: stream ChangeBatch

FieldTypeDescription
unitsChangeUnit[]The units, in log order. Empty for a batch whose entries carried no unit; the batch still moves cursor. The first may continue a unit an earlier batch began, and the last may stop inside one, which the next batch continues: a transaction with more events than one batch holds arrives in fragments.
cursorbytesWhere the stream continues after this batch: pass it on reconnect to resume here, and to AcknowledgeSubscription once the units are held. Opaque; it binds the history, the event interpretation and the interest.

AcknowledgeSubscription ​

State that the client holds, durably, every unit of its subscription before cursor: the registration may stop protecting that history, and a stream resumed without a cursor starts there. Only this call releases history; acknowledging an earlier cursor than a previous one changes nothing. Refused with INVALID_ARGUMENT for a cursor past what the serving node has applied (nothing that far was sent) or of another history, and like CancelSubscription for an ended or unknown incarnation.

Request: AcknowledgeSubscriptionRequest

FieldTypeDescription
consumer_idstringThe consumer acknowledging.
incarnationuint64Its incarnation, from the Subscribe response metadata.
cursorbytesThe cursor of the last batch the client no longer needs the source for: it holds the units durably, or it has durably taken their effect into the state it keeps. Everything before it is acknowledged: the server may release that source for this consumer, and a resume without a cursor continues from it.

Response: AcknowledgeSubscriptionResponse

Empty response (no fields).

CancelSubscription ​

End a consumer's registration: it stops holding the log, and its incarnation is refused from then on. Refused with FAILED_PRECONDITION and reason CONSUMER_TERMINATED when the incarnation has already ended, and NOT_FOUND for an id never registered.

Request: CancelSubscriptionRequest

FieldTypeDescription
consumer_idstringThe consumer to cancel.
incarnationuint64The incarnation to cancel, from the Subscribe response metadata. A different incarnation of the same id is left alone.

Response: CancelSubscriptionResponse

Empty response (no fields).

Types ​

AcknowledgeSubscriptionRequest ​

FieldTypeDescription
consumer_idstringThe consumer acknowledging.
incarnationuint64Its incarnation, from the Subscribe response metadata.
cursorbytesThe cursor of the last batch the client no longer needs the source for: it holds the units durably, or it has durably taken their effect into the state it keeps. Everything before it is acknowledged: the server may release that source for this consumer, and a resume without a cursor continues from it.

AcknowledgeSubscriptionResponse ​

No fields.

ArrayType ​

A homogeneous array type.

FieldTypeDescription
elementPropertyTypeThe type of every element. Required.

CancelSubscriptionRequest ​

FieldTypeDescription
consumer_idstringThe consumer to cancel.
incarnationuint64The incarnation to cancel, from the Subscribe response metadata. A different incarnation of the same id is left alone.

CancelSubscriptionResponse ​

No fields.

ChangeBatch ​

Units read from the log, and where the stream continues after them.

FieldTypeDescription
unitsChangeUnit[]The units, in log order. Empty for a batch whose entries carried no unit; the batch still moves cursor. The first may continue a unit an earlier batch began, and the last may stop inside one, which the next batch continues: a transaction with more events than one batch holds arrives in fragments.
cursorbytesWhere the stream continues after this batch: pass it on reconnect to resume here, and to AcknowledgeSubscription once the units are held. Opaque; it binds the history, the event interpretation and the interest.

ChangeInterest ​

What a subscription follows. Absent labels follows the nodes of every label; present and empty follows none. The same for edge_types.

FieldTypeDescription
labelsNameListLabels whose nodes the subscription follows: a node event reaches it when the node carries one of them before or after the event, its type's implied labels included. A name is bound to the label it names when the subscription opens; one not bound is refused with INVALID_ARGUMENT.
edge_typesNameListRelationship types whose relationships the subscription follows, by name.
blobsboolWhether the subscription follows blob objects: what each owner (a stored object, an S3 object, a node's large property) holds, put and removed. They belong to no label.

ChangeUnit ​

One committed transaction, or a fragment of one: the events of it in the ordinal range [first_ordinal, end_ordinal) the subscription takes.

FieldTypeDescription
commit_tsuint64HLC commit timestamp of the transaction, in wall-clock microseconds since the Unix epoch with logical increments inside one microsecond.
log_indexuint64The Raft log index of the entry carrying it.
unituint32Its place among the transactions of that entry.
projecteduint32How many events the transaction has in all, taken by the subscription or not: with the ordinals of the events received, the client tells it received every event of it its interest takes.
eventsLogicalChange[]The events the subscription takes, in ordinal order.
first_ordinaluint32The first ordinal this delivery covers: zero unless an earlier batch delivered the transaction's start.
end_ordinaluint32The ordinal after the last one this delivery covers, taken by the subscription or not: equal to projected when the delivery reaches the transaction's end. A transaction is complete once its deliveries cover [0, projected).

ComputedPropertyDefinition ​

A COMPUTED property of a label: evaluated from each node's data, stored once in the label definition and never per node. Read-only; a write to it is refused.

FieldTypeDescription
namestringProperty name, unique within the label and distinct from every stored property name.
computed_typeComputedTypeKind of computed property. Required.
formula_typeDecayFormulaTypeDecay formula, for DECAY and VECTOR_DECAY. Ignored for TTL.
lambdadoubleEXPONENTIAL rate, lambda = ln(2) / half_life_fraction, where half_life_fraction is the half-life as a fraction of duration_secs.
taudoublePOWER_LAW time scale as a fraction of the duration, greater than 0.
alphadoublePOWER_LAW exponent, greater than 0.
initialdoubleDECAY value at elapsed = 0.
targetdoubleDECAY value once elapsed >= duration_secs.
duration_secsuint64Length of the decay, or the TTL, in seconds. Greater than 0.
anchor_fieldstringName of the TIMESTAMP property elapsed time is measured from. Required; must be a stored TIMESTAMP property of the same label.
scopeTtlScopeTypeTTL only: what expiry deletes.
target_fieldstringTTL with scope SUBTREE only: the DOCUMENT property expiry deletes. Empty otherwise.

ConsumerRetention ​

Whether a consumer's registration protects the history it still needs. One of the two must be chosen; there is no default.

FieldTypeDescription
strictStrictRetentionProtection lasts until the consumer is cancelled. Missing heartbeats do not end it, and the log keeps every entry from the acknowledged position on.
ordinaryOrdinaryRetentionNo protection: the registration records the acknowledged position only, and the log's own retention decides how far back it reaches.

Label ​

A node label as the catalog holds it.

FieldTypeDescription
namestringLabel name. Case-sensitive.
declaredboolFalse for a label stored nodes carry without a definition; every other field is then empty.
propertiesPropertyDefinition[]Stored properties, by name.
computed_propertiesComputedPropertyDefinition[]Computed properties, by name.
schema_modeSchemaModeHow the label validates and stores properties.
temporalboolWhether nodes of the label carry a valid-time interval and keep one version per interval start. Fixed when the label is created.
schema_revisionuint64Revision of the definition. Every published change of the definition or of the label's constraints advances it; a published revision never changes.
candidateLabelCandidateA definition published but not yet in force: the stored nodes are being proved against it. The fields above stay the rules in force until the proof puts it in force; every write meanwhile must satisfy both. Unset when no proof is running.
kindLabelKindWhether the label is a node's type or an auxiliary label. Fixed when the label is created.
impliesstring[]For a type label, the labels every node of the type carries with it, as declared, sorted: the server writes them, transitively, on each node. Empty for an auxiliary label. Fixed when the label is created.

LabelCandidate ​

A label definition published and being proved over the stored nodes.

FieldTypeDescription
propertiesPropertyDefinition[]Stored properties it declares, by name.
computed_propertiesComputedPropertyDefinition[]Computed properties it declares, by name.
schema_modeSchemaModeHow it validates and stores properties.
operationuint64The operation proving it: awaited with AwaitSchema, cancelled with CancelIndexBuild.
impliesLabelCandidateImpliesThe labels the type implies once the candidate is in force; absent when the candidate leaves them as they are. Until then the label lookup and every index covering an affected label are reconciled to the new set in the background, and the implications in force still apply.

LabelCandidateImplies ​

The implied labels a candidate puts in force, wrapped so that "no change" (absent) and "implies nothing" (present and empty) are told apart.

FieldTypeDescription
labelsstring[]Label names, sorted, without repeats.

LogicalChange ​

One effect of a committed transaction.

FieldTypeDescription
ordinaluint32Its place among the transaction's events, counted before any subscription filters them: with log_index and unit, the event's identity, the same for every subscription and every delivery of it.
actionChangeActionWhat it does to its target.
payloadbytesThe record or properties a PUT writes, or the delta a PATCH applies, in the storage encoding; empty for a REMOVE and for a relationship's presence.
deliveryChangeDeliveryHow a node event reaches the subscription's labels: APPLY for a subscription following every label and for every relationship event.
labels_beforeLabel[]The labels a node carried before the transaction, its type's implied ones included; empty for a relationship event.
labels_afterLabel[]The labels a node carries after the event, its type's implied ones included; empty for a relationship event.
nodeNodeTargetA node's record, or one version of a temporal node.
relationshipRelationshipTargetA relationship's presence.
propertiesRelationshipTargetThe properties of a relationship that is neither versioned nor discriminated.
instanceRelationshipTargetOne version or discriminated instance of a relationship, its properties included.
scopeScopeTargetThe labels a type implies, as one activation of a change to them left them: every node of the type gains and loses labels without a node event of its own. labels_before and labels_after name the type and what it implied before and implies after.
blob_ownerbytesWhat a blob owner holds, by its owner key: a PUT carries the owner record (the blob it now holds, not the blob's bytes), a REMOVE none.
dropped_labelLabelA label a DROP ended: its identity, which a label created later under the same name does not share. labels_before holds it, labels_after is empty. Nodes of it the same transaction removed are removals of their own.

MultiVector ​

An ordered set of equal-width vectors representing one item, as produced by late-interaction retrieval models (ColBERT v2, MaxSim) where a document is several token-level embeddings rather than one pooled vector.

Every row carries the same number of dimensions; the sender enforces that invariant, so a receiver may read rows[0] for the width.

FieldTypeDescription
rowsVector[]—

NameList ​

A list of names, present even when empty.

FieldTypeDescription
namesstring[]The names.

NodeTarget ​

A node and, for a temporal node, the version.

FieldTypeDescription
node_iduint64The node's id.
valid_fromint64The version's start, in milliseconds since the Unix epoch, for a version of a temporal node.

OrdinaryRetention ​

Progress only, holding no history.

No fields.

Path ​

A graph path: the alternating node/relationship sequence produced by shortestPath(...) and by a variable-length MATCH p = (a)-[*]->(b).

rels has exactly one fewer entry than nodes on a non-empty path, and the n-th hop connects nodes[n] to nodes[n+1]. An empty path (a single node, zero hops) carries one node and no relationships.

FieldTypeDescription
nodesuint64[]Node ids along the path, start to end.
relsPathRel[]Relationship hops, in the same order.

PathRel ​

One relationship hop inside a Path: its type and endpoint node ids. Relationship properties are not carried; fetch them by endpoint pair when they are needed.

FieldTypeDescription
edge_typestring—
sourceuint64—
targetuint64—

PropertyDefinition ​

A stored property of a label or edge type. Carries the type facts of one property only; whether its values are unique is a constraint, listed by ListConstraints.

FieldTypeDescription
namestringProperty name, unique within the label or edge type. Case-sensitive.
typePropertyTypeDeclared type of the property's values. Required.
requiredboolWhether every record must carry a non-null value. A write without one is refused.
default_valuePropertyValueValue a record reads when it does not carry the property. Unset: no default, and a missing property reads as null.

PropertyType ​

The declared type of a stored property.

FieldTypeDescription
scalarScalarTypeA type without parameters.
vectorVectorTypeA dense vector with its dimensions and metric.
arrayArrayTypeAn array of elements of one type.

RelationshipTarget ​

A relationship, by type and endpoints, and its instance when it has one.

FieldTypeDescription
edge_typestringThe relationship type's name.
source_iduint64The source node's id.
target_iduint64The target node's id.
instancebytesThe version or discriminator of an instance, in its key encoding; empty for a relationship's presence or properties.

ScopeTarget ​

A type whose implied labels one activation changed.

FieldTypeDescription
labelLabelThe type label.
activationuint64The activation that put the change in force: distinct for every change, a change back to an earlier declaration included. A subscription keeping state by label reconciles the type's nodes once per activation, or rebuilds the scope.

StrictRetention ​

Protection until cancellation.

No fields.

SubscribeRequest ​

FieldTypeDescription
cursorbytesThe cursor of the last batch received. Omit to start where the registration stands.
interestChangeInterestWhat the subscription follows; with a cursor, the interest it was read with, by the names its labels were created under. A cursor keeps the labels it was read with: when one of them was dropped and its name created again, the stream still reads the dropped label, its DROP included, and not the new one.
consumer_idstringThe consumer this stream reads as: globally unique, chosen by the client. Required, non-empty and at most 65525 bytes of UTF-8; a longer id is refused with INVALID_ARGUMENT.
incarnationuint640 registers the consumer anew with retention, starting at cursor (or the oldest retained entry without one); refused with ALREADY_EXISTS while another incarnation of the id is live. Any other value resumes that live incarnation, and retention is ignored.
retentionConsumerRetentionRequired when registering (incarnation 0).

Timestamp ​

An instant on the time axis of a TIMESTAMP property.

FieldTypeDescription
unix_microsint64Microseconds since the Unix epoch (1970-01-01T00:00:00Z), signed: an instant before the epoch is negative. Microseconds are the database's own resolution, so the value round-trips exactly; a client converts it to its native type (a nanosecond type reaches it losslessly).

VectorType ​

A dense vector type.

FieldTypeDescription
dimensionsuint32Number of coordinates every value must have, from 1 to 65536. Zero declares no fixed length: values of any length are accepted, and a vector index takes its dimensions from its own definition.
metricDistanceMetricDistance metric the property is compared by. UNSPECIFIED means COSINE.

Enums ​

ChangeAction ​

What an event does to its target.

ValueNumberDescription
CHANGE_ACTION_UNSPECIFIED0—
CHANGE_ACTION_PUT1The target is written whole: it is replaced, or comes to exist. A PUT does not say which.
CHANGE_ACTION_PATCH2The target changes by the payload's delta.
CHANGE_ACTION_REMOVE3The target ceases to exist.
CHANGE_ACTION_SCOPE_CHANGE4What a type implies changed: its nodes enter and leave label scopes with no node event of their own.
CHANGE_ACTION_DROP5A label is dropped: its identity ends, its scope with it.

ChangeDelivery ​

How a node event reaches a subscription following some labels.

ValueNumberDescription
CHANGE_DELIVERY_UNSPECIFIED0—
CHANGE_DELIVERY_APPLY1The node is in the subscription's scope before and after: the event applies.
CHANGE_DELIVERY_ENTER2The node joins the scope with the record the event writes.
CHANGE_DELIVERY_LEAVE3The node leaves the scope: deleted, relabelled or retyped out of it.

ComputedType ​

The kind of COMPUTED property.

ValueNumberDescription
COMPUTED_TYPE_UNSPECIFIED0Not a kind. Refused.
COMPUTED_TYPE_TTL1The node, or part of it, is deleted once duration_secs has elapsed since the anchor_field timestamp; scope says which part.
COMPUTED_TYPE_DECAY2Value interpolated from initial to target over duration_secs, evaluated when read: initial + (target - initial) * formula(elapsed).
COMPUTED_TYPE_VECTOR_DECAY3Multiplier in [0, 1] that a vector similarity score is scaled by when read, from the formula over the time elapsed since anchor_field.

DecayFormulaType ​

Decay formula of a DECAY or VECTOR_DECAY computed property. Every formula maps normalized time t in [0, 1] to a weight in [0, 1].

ValueNumberDescription
DECAY_FORMULA_TYPE_UNSPECIFIED0LINEAR.
DECAY_FORMULA_TYPE_LINEAR1f(t) = max(0, 1 - t): constant rate, zero at the end of the duration.
DECAY_FORMULA_TYPE_EXPONENTIAL2f(t) = e^(-lambda * t). Requires lambda.
DECAY_FORMULA_TYPE_POWER_LAW3f(t) = (1 + t / tau)^(-alpha): fast early decay with a long tail. Requires tau and alpha.
DECAY_FORMULA_TYPE_STEP4f(t) = 1 while t < 1, then 0.

DistanceMetric ​

ValueNumberDescription
DISTANCE_METRIC_UNSPECIFIED0—
DISTANCE_METRIC_COSINE1—
DISTANCE_METRIC_L22—
DISTANCE_METRIC_DOT3—
DISTANCE_METRIC_L14—

LabelKind ​

What a label is to the nodes carrying it. A node carries exactly one type label, found by kind whatever order its labels are written in, besides the labels that type implies and any auxiliary labels.

ValueNumberDescription
LABEL_KIND_UNSPECIFIED0TYPE.
LABEL_KIND_TYPE1The node's type: its definition gives the node's schema, mode and placement. A label used without a definition is a FLEXIBLE type label.
LABEL_KIND_AUXILIARY2Classifies nodes (scope, role, tag). Declares no properties, is not temporal and is never a node's only label.

ScalarType ​

The scalar property types: types that take no parameters.

ValueNumberDescription
SCALAR_TYPE_UNSPECIFIED0Not a type. Refused when a type is required.
SCALAR_TYPE_STRING1UTF-8 text.
SCALAR_TYPE_INT642Signed 64-bit integer.
SCALAR_TYPE_FLOAT643IEEE 754 binary64 floating point number.
SCALAR_TYPE_BOOL4Boolean.
SCALAR_TYPE_TIMESTAMP5Point in time.
SCALAR_TYPE_BLOB6Large binary object stored apart from the record and read by reference.
SCALAR_TYPE_BINARY7Binary value stored inline in the record.
SCALAR_TYPE_MAP8Map of string keys to values.
SCALAR_TYPE_GEO9Geographic point or shape.
SCALAR_TYPE_DOCUMENT10Arbitrary nested document; its content is not type-checked.

SchemaMode ​

How a label validates and stores the properties of its nodes.

ValueNumberDescription
SCHEMA_MODE_UNSPECIFIED0STRICT.
SCHEMA_MODE_STRICT1Only declared properties are accepted; a write with any other is refused. Property names are interned, the most compact form.
SCHEMA_MODE_VALIDATED2Declared properties are type-checked and interned; other properties are accepted unchecked and stored by name.
SCHEMA_MODE_FLEXIBLE3No property is checked against the definition beyond requiredness and defaults; every property is stored by name.

TtlScopeType ​

What a TTL computed property deletes when it expires.

ValueNumberDescription
TTL_SCOPE_TYPE_UNSPECIFIED0NODE.
TTL_SCOPE_TYPE_FIELD1Only the anchor_field property; the node remains.
TTL_SCOPE_TYPE_SUBTREE2Only the DOCUMENT property named by target_field; the anchor_field timestamp remains.
TTL_SCOPE_TYPE_NODE3The whole node with all its edges.