Skip to main content

JsonFileCommitter

Local files of JSON format.

Notesโ€‹

File Formatโ€‹

The generated file content will contain any number of "upsert" and "delete" objects. Both objects will contain the document "reference" and "metadata". The metadata is made of names followed by an undefined number of values as an array. The "upsert" entries also have a "content" property. Like this example containing 1 "upsert" and 1 "delete":

[
{"upsert": {
"reference": "https://example.com/my-document.html",
"metadata": {
"title": ["My Example Document"],
"keywords": [
"Example",
"Demo"
],
},
"content": "Document content goes here."
}},
{"delete": {
"reference": "https://example.com/i-was-deleted.html",
"metadata": {
"contentType": ["text/html"],
}
}},
]

Examplesโ€‹

class: JsonFileCommitter
filePath: /path/to/committer.json

Usageโ€‹

Full configuration skeleton, with every option and its default
class: JsonFileCommitter
compress: false
directory: string
docsPerFile: 0
fieldMappings: {}
fileNamePrefix: string
fileNameSuffix: string
indent: 0
restrictions:
- fieldMatcher: {}
valueMatcher: {}
splitUpsertDelete: false

Propertiesโ€‹

PropertyTypeRequiredDefault
compressbooleanNofalse
directorystringNo-
docsPerFileintegerNo0
fieldMappingsRecord<string, string>No-
fileNamePrefixstringNo-
fileNameSuffixstringNo-
indentintegerNo-1
restrictionsPropertyMatcher[]No-
splitUpsertDeletebooleanNofalse

Property Detailsโ€‹

compressโ€‹

Compress the generated JSON files using the GZIP file format.

directoryโ€‹

Local path where JSON files will be written.

docsPerFileโ€‹

Maximum number of documents per JSON files.

fieldMappingsโ€‹

Mapping of source fields to target JSON properties.

fileNamePrefixโ€‹

A string prepended to generated file names to distinguish them from other output files.

fileNameSuffixโ€‹

A string appended to generated file names (before the extension) to distinguish them from other output files.

indentโ€‹

Number of indentation spaces. Default does not indent.

restrictionsโ€‹

Defines filter conditions that restrict which documents this committer processes. Documents not matching the restrictions are ignored by this committer.

splitUpsertDeleteโ€‹

When enabled, a single update operation is split into separate upsert and delete operations for compatibility with the target system.