Neo4jCommitter
Commit documents to a Neo4j graph database.
Notesβ
Commits crawled documents to a Neo4j graph database using configurable Cypher queries for upserts and deletes. Field mappings, multi-value joining, and optional parameters for missing fields are supported.
Examplesβ
Creates or updates one node per crawled document, keyed on its reference.
- YAML
- JSON
- XML
committer:
class: Neo4jCommitter
uri: bolt://localhost:7687
credentials:
username: neo4j
password: changeme
database: neo4j
nodeIdProperty: id
nodeContentProperty: content
upsertCypher: "MERGE (d:Document {id: $id}) SET d.content = $content, d.title = $title"
{
"committer": {
"class": "Neo4jCommitter",
"uri": "bolt://localhost:7687",
"credentials": {
"username": "neo4j",
"password": "changeme"
},
"database": "neo4j",
"nodeIdProperty": "id",
"nodeContentProperty": "content",
"upsertCypher": "MERGE (d:Document {id: $id}) SET d.content = $content, d.title = $title"
}
}
<committer class="Neo4jCommitter">
<uri>bolt://localhost:7687</uri>
<credentials>
<username>neo4j</username>
<password>changeme</password>
</credentials>
<database>neo4j</database>
<nodeIdProperty>id</nodeIdProperty>
<nodeContentProperty>content</nodeContentProperty>
<upsertCypher>MERGE (d:Document {id: $id}) SET d.content = $content, d.title = $title</upsertCypher>
</committer>
Usageβ
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
class: Neo4jCommitter
credentials:
password: string
passwordKey:
size: 0
source: KEY
value: string
username: string
database: string
deleteCypher: string
fieldMappings: {}
multiValuesJoiner: string
nodeContentProperty: string
nodeIdProperty: string
optionalParameters:
- string
queue:
class: FsQueue
batchSize: 0
commitLeftoversOnInit: false
maxPerFolder: 0
onCommitFailure:
ignoreErrors: false
maxRetries: 0
retryDelay: 0
splitBatch: OFF
restrictions:
- fieldMatcher: {}
valueMatcher: {}
upsertCypher: string
uri: string
{
"class": "Neo4jCommitter",
"credentials": {
"password": "string",
"passwordKey": {
"size": 0,
"source": "KEY",
"value": "string"
},
"username": "string"
},
"database": "string",
"deleteCypher": "string",
"fieldMappings": {},
"multiValuesJoiner": "string",
"nodeContentProperty": "string",
"nodeIdProperty": "string",
"optionalParameters": [
"string"
],
"queue": {
"class": "FsQueue",
"batchSize": 0,
"commitLeftoversOnInit": false,
"maxPerFolder": 0,
"onCommitFailure": {
"ignoreErrors": false,
"maxRetries": 0,
"retryDelay": 0,
"splitBatch": "OFF"
}
},
"restrictions": [
{
"fieldMatcher": {},
"valueMatcher": {}
}
],
"upsertCypher": "string",
"uri": "string"
}
<neo4jCommitter>
<class>Neo4jCommitter</class>
<credentials>
<password>string</password>
<passwordKey>
<size>0</size>
<source>KEY</source>
<value>string</value>
</passwordKey>
<username>string</username>
</credentials>
<database>string</database>
<deleteCypher>string</deleteCypher>
<fieldMappings/>
<multiValuesJoiner>string</multiValuesJoiner>
<nodeContentProperty>string</nodeContentProperty>
<nodeIdProperty>string</nodeIdProperty>
<optionalParameters>
<optionalParameter>string</optionalParameter>
</optionalParameters>
<queue>
<class>FsQueue</class>
<batchSize>0</batchSize>
<commitLeftoversOnInit>false</commitLeftoversOnInit>
<maxPerFolder>0</maxPerFolder>
<onCommitFailure/>
</queue>
<restrictions>
<restriction>
<fieldMatcher/>
<valueMatcher/>
</restriction>
</restrictions>
<upsertCypher>string</upsertCypher>
<uri>string</uri>
</neo4jCommitter>
Propertiesβ
| Property | Type | Required | Default |
|---|---|---|---|
credentials | Credentials | No | Credentials |
database | string | No | - |
deleteCypher | string | No | - |
fieldMappings | Record<string, string> | No | - |
multiValuesJoiner | string | No | - |
nodeContentProperty | string | No | content |
nodeIdProperty | string | No | id |
optionalParameters | string[] | No | - |
queue | CommitterQueue | No | FsQueue |
restrictions | PropertyMatcher[] | No | - |
upsertCypher | string | No | - |
uri | string | No | - |
Property Detailsβ
credentialsβ
Username and password to Neo4j.
databaseβ
Database name when using one other than the default.
deleteCypherβ
Cypher query for deleting relationships in Neo4j. Typically, you want to use "nodeIdProperty" value to delete nodes having a matching property value. The query parameters correspond the document fields.
fieldMappingsβ
Mapping of source fields to target ones (Neo4j property).
multiValuesJoinerβ
Characters used to join a multi-valued field into the single value stored on the node. Default is |. Choose something that cannot appear in your values if you intend to split them apart again later.
nodeContentPropertyβ
Property name where to store the document content in Neo4j graph entries. Use it as a cypher parameter in your configured "upsertCypher" query. Default is "content".
nodeIdPropertyβ
Property name where to store the document reference in Neo4j graph entries. Use it as a cypher parameter to uniquely identify your graph entries in your configured "upsertCypher" and "deleteCypher" queries. Default is "id".
optionalParametersβ
Comma-separated list of parameter names that can be missing when creating the query. They will be set to NullValue to avoid client exception for missing parameters.
queueβ
Configures the committer queue used to batch documents before sending them to the target system. Adjust queue settings to tune throughput and memory usage.
restrictionsβ
Defines filter conditions that restrict which documents this committer processes. Documents not matching the restrictions are ignored by this committer.
upsertCypherβ
Cypher query for adding relationships to Neo4j. Typically, you want to use MERGE and the "nodeIdProperty" value to update existing entries matching the ID. In order to later delete all nodes related to an entry, make sure to add the ID property on all appropriate nodes. The query parameters correspond the document fields.
uriβ
Required connection URI. E.g., bolt://localhost:7687.