Format of change events
The content of the change events differs depending on the type of entity (node or relationship).
Node changes
Format of change events for nodes
{
"id": "A7fjWXMK_0L6hztd4xhoy0oAAAAAAAAADAAAAAAAAAAA", (1)
"txId": 12, (2)
"seq": 0, (3)
"metadata": {
"executingUser": "neo4j", (4)
"authenticatedUser": "neo4j", (5)
"captureMode": "FULL", (6)
"connectionClient": "127.0.0.1:51320", (7)
"serverId": "e605bd8f", (8)
"databaseId": "edec6ba8-e82f-4aac-ae41-2725f2357fdd", (9)
"connectionType": "bolt", (10)
"connectionServer": "127.0.0.1:51316", (11)
"txStartTime": "2023-03-03T11:58:30.429Z", (12)
"txCommitTime": "2023-03-03T11:58:30.526Z", (13)
"txMetadata": { (14)
"correlationId": "123456789"
}
},
"event": {
"elementId": "4:b7e35973-0aff-42fa-873b-5de31868cb4a:1", (15)
"keys": { (16)
"Person": [
{
"firstName": "john",
"lastName": "doe"
},
{
"ssn": "Y654321"
}
],
"Employee": [
{
"id": 1001
}
]
},
"eventType": "n", (17)
"state": {
"before": null, (18)
"after": { (19)
"properties": { (20)
"tagline": "Houston, we have a problem.",
"title": "Apollo 13",
"released": "1995"
},
"labels": ["MOVIE"] (21)
}
},
"operation": "c", (22)
"labels": ["MOVIE"] (23)
}
}
1 | A unique change identifier that identifies this change record. It can be used to query changes from this change onward. |
2 | A number identifying which transaction the change happened in, unique in combination with seq .
Transaction identifiers are not continuous (some transactions, such as system and schema commands, are not recorded in change data capture and cause gaps in the transaction identifiers). |
3 | A number used for ordering changes that happened in the same transaction. The order of changes observed in the output does not necessarily correspond to the order in which changes were applied during the transaction. |
4 | The user that performed this change.
May be different from authenticatedUser when using impersonation. |
5 | The authenticated user when this change was performed. |
6 | The transaction log CDC mode at the time this change was captured. |
7 | The client’s address (usually IP address and port, but it might change based on protocol). |
8 | The identifier of the server that performed this change. See Operations Manual → Clustering → Managing servers in a cluster for more information on servers. |
9 | The database unique ID. See Operations Manual → Database administration for more information on managing multiple databases. |
10 | The protocol under which the client is connected through. |
11 | The server’s address (usually IP address and port but might change based on protocol). |
12 | The timestamp when the underlying transaction started. |
13 | The timestamp when the underlying transaction committed. |
14 | The metadata associated with the transaction when the operation was performed. |
15 | The elementId of the changed entity (node or relationship). |
16 | The keys identifying the changed entity. This requires key constraints defined on the changed entities, see The role of elementIds and key properties for details. |
17 | Type of the changed entity: n for nodes and r for relationships. |
18 | A map describing the state of the entity before the change.
This field is always NULL for create events.
When on DIFF CDC mode, it is limited to the properties and labels of the entity that have changed.
This field always contains the full state of the entity for delete events, regardless of whether the CDC mode is set to DIFF or FULL . |
19 | A map describing the state of the entity after the change.
This field is always NULL for delete events.
When on DIFF CDC mode, it is limited to the properties and labels of the entity that have changed.
This field always contains the full state of the entity for create events, regardless of whether the CDC mode is set to DIFF or FULL . |
20 | A map of properties of the entity after the change. |
21 | List of node labels after the change was applied.
When on DIFF CDC mode, it is limited to the changed labels. |
22 | Type of the operation: c for creates, u for updates, d for deletions. |
23 | List of node labels before the change was applied. It contains the complete set of labels regardless of the CDC mode. |
Relationship changes
Change events for relationships follow a similar schema to node changes.
Only the differences are annotated below.
Format of change events for relationships
{
"id": "A2pK9P_aOknnrnEsCsPB_BoAAAAAAAAADwAAAAAAAAAA",
"txId": 15,
"seq": 0,
"metadata": {
"executingUser": "neo4j",
"authenticatedUser": "neo4j",
"captureMode": "FULL",
"connectionClient": "127.0.0.1:51190",
"serverId": "2230d17a",
"databaseId": "edec6ba8-e82f-4aac-ae41-2725f2357fdd",
"connectionType": "bolt",
"connectionServer": "127.0.0.1:51186",
"txStartTime": "2023-03-03T11:54:40.510Z",
"txCommitTime": "2023-03-03T11:54:40.773Z",
"txMetadata": {
"correlationId": "987654321"
}
},
"event": {
"elementId": "5:6a4af4ff-da3a-49e7-ae71-2c0ac3c1fc1a:0",
"start": { (1)
"elementId": "4:6a4af4ff-da3a-49e7-ae71-2c0ac3c1fc1a:0", (2)
"keys": {}, (3)
"labels": ["PERSON"] (4)
},
"end": { (5)
"elementId": "4:6a4af4ff-da3a-49e7-ae71-2c0ac3c1fc1a:1",
"keys": {},
"labels": [
"MOVIE"
]
},
"eventType": "r",
"state": { (6)
"before": null,
"after": {
"properties": {
"roles": "Jack Swigert"
}
}
},
"type": "ACTED_IN", (7)
"operation": "c",
"keys": [ (8)
{
"registerId": 1125
},
{
"official": "Alice Roberts"
}
]
}
}
1 | A map containing information about the start node. |
2 | ElementId of the start node. |
3 | Keys (if related constraints are defined) of the start node. |
4 | List of labels of the start node. |
5 | Same set of information defined above for the end node. |
6 | Since relationships do not have labels, there is no field for labels in the before / after state. |
7 | Relationship type. |
8 | The keys identifying the changed entity. This requires key constraints defined on the changed entities, see The role of elementIds and key properties for details. |