Skip to main content

ElasticsearchCommitter

Commit documents to Elasticsearch or Amazon OpenSearch.

committer/elasticsearchJavadoc: ElasticsearchCommitter

Notes​

Commits crawled documents to an Elasticsearch or Amazon OpenSearch index. Supports cluster node discovery, field mappings, dot replacement in field names, JSON field handling, and optional ID fix-up for documents with long references.

Examples​

The following example uses the minimum required settings to configure Elasticsearch (or AWS OpenSearch) Committer.

class: ElasticsearchCommitter
indexName: some_index

Usage​

Full configuration skeleton, with every option and its default
class: ElasticsearchCommitter
acl:
flatPrefix: string
format: NATIVE
partial: REJECT
apiKey: string
connectionTimeout: 0
credentials:
password: string
passwordKey:
size: 0
source: KEY
value: string
username: string
discoverNodes: false
dotReplacement: string
fieldMappings: {}
fixBadIds: false
ignoreResponseErrors: false
indexName: string
jsonFieldsPattern: string
nodes:
- string
queue:
class: FsQueue
batchSize: 0
commitLeftoversOnInit: false
maxPerFolder: 0
onCommitFailure:
ignoreErrors: false
maxRetries: 0
retryDelay: 0
splitBatch: OFF
restrictions:
- fieldMatcher: {}
valueMatcher: {}
socketTimeout: 0
sourceIdField: string
targetContentField: string
typeName: string

Properties​

PropertyTypeRequiredDefault
aclAclCommitterConfigNoAclCommitterConfig
apiKeystringNo-
connectionTimeoutintegerNo1000
credentialsCredentialsNoCredentials
discoverNodesbooleanNofalse
dotReplacementstringNo-
fieldMappingsRecord<string, string>No-
fixBadIdsbooleanNofalse
ignoreResponseErrorsbooleanNofalse
indexNamestringNo-
jsonFieldsPatternstringNo-
nodesstring[]No[http://localhost:9200]
queueCommitterQueueNoFsQueue
restrictionsPropertyMatcher[]No-
socketTimeoutintegerNo30000
sourceIdFieldstringNo-
targetContentFieldstringNocontent
typeNamestringNo-

Property Details​

acl​

How this committer sends the access control list (ACL) a document carries in its crawler.acl field, written by the fetchers that read a source's permissions:

  • format: JSON sends the field as it is; FLAT replaces it with plain fields (below); NATIVE writes it as the destination's own access control, for committers whose destination has one; NONE does not send it. When not set, the committer's default applies (NATIVE where available, otherwise JSON).
  • partial: what to do with a document whose permissions could only be read in part: REJECT (the default) or SEND.
  • flatPrefix: the prefix of the FLAT fields. Default is acl.

A document whose permissions cannot be vouched for is withheld: it is not sent, a version sent before is removed from the destination, and the crawler tries it again on its next run. That is the case when its ACL is partial and partial is REJECT, when its permissions could not be read at all, when the ACL is unreadable or of an unknown version, or when NATIVE cannot express it. A withheld document is never sent as readable by everyone.

With FLAT, acl.levels names the checks a person must pass, in order, and each level has an allow field and a deny field holding principals as kind:dir:id (or special:id):

acl.levels = share, file
acl.share.allow = group:ad:CORP:Sales
acl.file.allow = group:ad:CORP:Sales
acl.file.deny = group:ad:CORP:Interns
acl.owners = user:ad:CORP:pascal

A person may see the document if they match an allow value of every level and no deny value of any.

apiKey​

API key for authentication with Elasticsearch or Amazon OpenSearch.

connectionTimeout​

Maximum wait time for a requested connection to be fully established, in milliseconds. Default is 1 second (1000 ms).

credentials​

Username and password to a protected Elasticsearch.

discoverNodes​

Enable automatic discovery of Elasticsearch cluster nodes.

dotReplacement​

The character used to replace dots in field names. Leave blank to keep the dots in field names (nested fields).

fieldMappings​

Mapping of source fields to target ones (Elasticsearch fields).

fixBadIds​

Fix IDs that are too long for Elasticsearch ID limitation (512 bytes max). When enabled, long IDs will be truncated and a hash code representing the truncated part will be appended.

ignoreResponseErrors​

Log Elasticsearch response errors instead of throwing an exception.

indexName​

Name of target Elasticsearch index where documents will be stored.

jsonFieldsPattern​

Regular expression matching fields whose values are raw JSON rather than regular strings, such as a JSON object or, for a multi-valued field, a list of numbers like an embedding vector. Values of matching fields are sent as they are, unquoted.

nodes​

One or more Elasticsearch nodes to connect to. Defaults to http://localhost:9200.

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.

socketTimeout​

The maximum time in milliseconds to wait for data on an established connection before giving up.

sourceIdField​

Source document field name containing the value to be stored in Elasticsearch "_id" field. Leave blank to use the document reference instead of a field (default).

targetContentField​

Target Elasticsearch field name where content will be stored. Default is "content". Leave blank to disable storing the content.

typeName​

Type name used in older versions of Elasticsearch. Leave blank if using Elasticsearch 7.0. or higher.