Skip to main content

SolrCommitter

Commit documents to Apache Solr search engine (standalone or SolrCloud).

Notes​

Commits crawled documents to an Apache Solr search engine, or a Solr-based product. Documents are sent as JSON over HTTP using the JDK HTTP client (SolrJ is not required). Supports a single node, several nodes with load balancing and failover, and SolrCloud. Also supports field mappings, optional explicit Solr commit control, custom URL parameters, and several authentication options.

This committer is bundled with the web and file system crawler distributions.

Connection mode​

Documents are sent to the Solr core or collection URLs listed in nodes, e.g., http://localhost:8983/solr/mycollection. The connectionMode defines how they are used:

  • SINGLE_NODE: a single Solr node. This is the default with one node. HTTP/2 is used for https URLs (see httpVersion).
  • LOAD_BALANCED: several Solr nodes. This is the default with more than one node. Updates are spread across nodes. A failing node is set aside for a while and the request is sent to another one.
  • CLOUD: a SolrCloud cluster. Each node URL ends with the collection name. The nodes hosting the collection are discovered over HTTP (Collections API CLUSTERSTATUS) and refreshed periodically. If the cluster state cannot be obtained, or discovered nodes are not reachable, the configured nodes are used. SolrCloud has to be set explicitly. ZooKeeper connection strings are not supported.

The deprecated solrClientType and solrURL are replaced by connectionMode, httpVersion and nodes. They are still honored for now, and translate as follows:

solrClientTypeReplaced by
HttpJettySolrClient, HttpJdkSolrClient, ConcurrentUpdateJettySolrClientconnectionMode: SINGLE_NODE
LBJettySolrClientconnectionMode: LOAD_BALANCED
CloudSolrClientconnectionMode: CLOUD
HttpSolrClient, ConcurrentUpdateSolrClientSINGLE_NODE and httpVersion: HTTP_1_1
LBHttpSolrClientLOAD_BALANCED and httpVersion: HTTP_1_1

Authentication​

Sent with every request to Solr:

  • Basic authentication: credentials (the password can be encrypted).
  • Bearer token: bearerToken (e.g., Solr JWT authentication plugin). Ignored when credentials are set.
  • Custom HTTP headers: headers (e.g., for an API gateway). They can override the Authorization header set by the above.
  • TLS: HTTPS connections use the JVM trust store. Use the standard javax.net.ssl.* system properties to customize it (including client certificates).

HTTP proxies are those of the JVM (http.proxyHost, https.proxyHost, ...). Kerberos is not supported.

Examples​

Single Solr node:

class: SolrCommitter
nodes:
- http://localhost:8983/solr/mycollection

SolrCloud with basic authentication:

class: SolrCommitter
connectionMode: CLOUD
nodes:
- https://solr1:8983/solr/mycollection
- https://solr2:8983/solr/mycollection
credentials:
username: myuser
password: mypassword

Bearer token and custom header:

class: SolrCommitter
nodes:
- https://solr.example.com/solr/mycollection
bearerToken: eyJhbGciOi...
headers:
X-Api-Key: abc123

Usage​

Full configuration skeleton, with every option and its default
class: SolrCommitter
acl:
flatPrefix: string
format: NATIVE
partial: REJECT
bearerToken: string
connectionMode: SINGLE_NODE
connectionTimeout: 0
credentials:
password: string
passwordKey:
size: 0
source: KEY
value: string
username: string
fieldMappings: {}
headers: {}
httpVersion: AUTO
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
solrClientType: CloudSolrClient
solrCommitDisabled: false
solrURL: string
sourceIdField: string
targetContentField: string
targetIdField: string
updateUrlParams: {}

Properties​

PropertyTypeRequiredDefault
aclAclCommitterConfigNoAclCommitterConfig
bearerTokenstringNo-
connectionModeenumNo-
connectionTimeoutintegerNo10000
credentialsCredentialsNoCredentials
fieldMappingsRecord<string, string>No-
headersRecord<string, string>No-
httpVersionenumNo-
nodesstring[]No-
queueCommitterQueueNoFsQueue
restrictionsPropertyMatcher[]No-
socketTimeoutintegerNo120000
solrClientTypeenumNo-
solrCommitDisabledbooleanNofalse
solrURLstringNo-
sourceIdFieldstringNo-
targetContentFieldstringNocontent
targetIdFieldstringNoid
updateUrlParamsRecord<string, string>No-

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.

bearerToken​

Bearer token (e.g., JWT) sent as an Authorization header with every request. Ignored when credentials are set.

connectionMode​

How to connect to the Solr nodes: SINGLE_NODE, LOAD_BALANCED or CLOUD (see "Connection mode" above). When not set, it is SINGLE_NODE with one node and LOAD_BALANCED with several. SolrCloud must be set explicitly.

Allowed Values​

  • SINGLE_NODE
  • LOAD_BALANCED
  • CLOUD

connectionTimeout​

Maximum time to wait for a connection to be established. Default is 10 seconds.

credentials​

Username and password to a protected Solr (basic authentication).

fieldMappings​

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

headers​

Custom HTTP headers sent with every request, as name/value pairs. A header named Authorization replaces the one derived from credentials or bearerToken.

httpVersion​

HTTP protocol version: AUTO (default), HTTP_1_1 or HTTP_2. With AUTO, HTTP/2 is used for https URLs and HTTP/1.1 for http ones.

Allowed Values​

  • AUTO
  • HTTP_1_1
  • HTTP_2

nodes​

URLs of the Solr core or collection to send documents to, e.g., http://localhost:8983/solr/mycollection. For SolrCloud, each URL ends with the collection name. Replaces the deprecated solrURL.

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​

Maximum time to wait for Solr to respond to a request (a batch of documents). Default is 120 seconds.

solrClientType​

Deprecated: use connectionMode and httpVersion instead (see "Connection mode" above).

Allowed Values​

  • CloudSolrClient
  • HttpJettySolrClient
  • LBJettySolrClient
  • ConcurrentUpdateJettySolrClient
  • HttpJdkSolrClient
  • HttpSolrClient
  • LBHttpSolrClient
  • ConcurrentUpdateSolrClient

solrCommitDisabled​

Disable sending an explicit Solr commit request at the end of every batch sent, relying Solr to perform auto-commit instead.

solrURL​

Deprecated: use nodes instead. Comma-separated Solr URLs.

sourceIdField​

Document field name containing the value that will be stored in Solr target ID field. Default is the document reference.

targetContentField​

Solr field name to store a document content. Default is "content".

targetIdField​

Solr field name where to store a document unique identifier (source ID field). Default is "id".

updateUrlParams​

Parameters to be added on Solr HTTP calls (e.g., commitWithin).