Skip to main content

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.

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"

Usage​

Full configuration skeleton, with every option and its default
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

Properties​

PropertyTypeRequiredDefault
credentialsCredentialsNoCredentials
databasestringNo-
deleteCypherstringNo-
fieldMappingsRecord<string, string>No-
multiValuesJoinerstringNo-
nodeContentPropertystringNocontent
nodeIdPropertystringNoid
optionalParametersstring[]No-
queueCommitterQueueNoFsQueue
restrictionsPropertyMatcher[]No-
upsertCypherstringNo-
uristringNo-

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.