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/2is used forhttpsURLs (seehttpVersion).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 APICLUSTERSTATUS) 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:
solrClientType | Replaced by |
|---|---|
HttpJettySolrClient, HttpJdkSolrClient, ConcurrentUpdateJettySolrClient | connectionMode: SINGLE_NODE |
LBJettySolrClient | connectionMode: LOAD_BALANCED |
CloudSolrClient | connectionMode: CLOUD |
HttpSolrClient, ConcurrentUpdateSolrClient | SINGLE_NODE and httpVersion: HTTP_1_1 |
LBHttpSolrClient | LOAD_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 whencredentialsare set. - Custom HTTP headers:
headers(e.g., for an API gateway). They can override theAuthorizationheader 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:
- YAML
- JSON
- XML
class: SolrCommitter
nodes:
- http://localhost:8983/solr/mycollection
{
"class": "SolrCommitter",
"nodes": [
"http://localhost:8983/solr/mycollection"
]
}
<class>SolrCommitter</class>
<nodes>http://localhost:8983/solr/mycollection</nodes>
SolrCloud with basic authentication:
- YAML
- JSON
- XML
class: SolrCommitter
connectionMode: CLOUD
nodes:
- https://solr1:8983/solr/mycollection
- https://solr2:8983/solr/mycollection
credentials:
username: myuser
password: mypassword
{
"class": "SolrCommitter",
"connectionMode": "CLOUD",
"nodes": [
"https://solr1:8983/solr/mycollection",
"https://solr2:8983/solr/mycollection"
],
"credentials": {
"username": "myuser",
"password": "mypassword"
}
}
<class>SolrCommitter</class>
<connectionMode>CLOUD</connectionMode>
<nodes>https://solr1:8983/solr/mycollection</nodes>
<nodes>https://solr2:8983/solr/mycollection</nodes>
<credentials>
<username>myuser</username>
<password>mypassword</password>
</credentials>
Bearer token and custom header:
- YAML
- JSON
- XML
class: SolrCommitter
nodes:
- https://solr.example.com/solr/mycollection
bearerToken: eyJhbGciOi...
headers:
X-Api-Key: abc123
{
"class": "SolrCommitter",
"nodes": [
"https://solr.example.com/solr/mycollection"
],
"bearerToken": "eyJhbGciOi...",
"headers": {
"X-Api-Key": "abc123"
}
}
<class>SolrCommitter</class>
<nodes>https://solr.example.com/solr/mycollection</nodes>
<bearerToken>eyJhbGciOi...</bearerToken>
<headers>
<X-Api-Key>abc123</X-Api-Key>
</headers>
Usage
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
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: {}
{
"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": {}
}
<solrCommitter>
<class>SolrCommitter</class>
<acl>
<flatPrefix>string</flatPrefix>
<format>NATIVE</format>
<partial>REJECT</partial>
</acl>
<bearerToken>string</bearerToken>
<connectionMode>SINGLE_NODE</connectionMode>
<connectionTimeout>0</connectionTimeout>
<credentials>
<password>string</password>
<passwordKey>
<size>0</size>
<source>KEY</source>
<value>string</value>
</passwordKey>
<username>string</username>
</credentials>
<fieldMappings/>
<headers/>
<httpVersion>AUTO</httpVersion>
<nodes>
<node>string</node>
</nodes>
<queue>
<class>FsQueue</class>
<batchSize>0</batchSize>
<commitLeftoversOnInit>false</commitLeftoversOnInit>
<maxPerFolder>0</maxPerFolder>
<onCommitFailure/>
</queue>
<restrictions>
<restriction>
<fieldMatcher/>
<valueMatcher/>
</restriction>
</restrictions>
<socketTimeout>0</socketTimeout>
<solrClientType>CloudSolrClient</solrClientType>
<solrCommitDisabled>false</solrCommitDisabled>
<solrURL>string</solrURL>
<sourceIdField>string</sourceIdField>
<targetContentField>string</targetContentField>
<targetIdField>string</targetIdField>
<updateUrlParams/>
</solrCommitter>
Properties
| Property | Type | Required | Default |
|---|---|---|---|
acl | AclCommitterConfig | No | AclCommitterConfig |
bearerToken | string | No | - |
connectionMode | enum | No | - |
connectionTimeout | integer | No | 10000 |
credentials | Credentials | No | Credentials |
fieldMappings | Record<string, string> | No | - |
headers | Record<string, string> | No | - |
httpVersion | enum | No | - |
nodes | string[] | No | - |
queue | CommitterQueue | No | FsQueue |
restrictions | PropertyMatcher[] | No | - |
socketTimeout | integer | No | 120000 |
solrClientType | enum | No | - |
solrCommitDisabled | boolean | No | false |
solrURL | string | No | - |
sourceIdField | string | No | - |
targetContentField | string | No | content |
targetIdField | string | No | id |
updateUrlParams | Record<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:JSONsends the field as it is;FLATreplaces it with plain fields (below);NATIVEwrites it as the destination's own access control, for committers whose destination has one;NONEdoes not send it. When not set, the committer's default applies (NATIVEwhere available, otherwiseJSON).partial: what to do with a document whose permissions could only be read in part:REJECT(the default) orSEND.flatPrefix: the prefix of theFLATfields. Default isacl.
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_NODELOAD_BALANCEDCLOUD
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
AUTOHTTP_1_1HTTP_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
CloudSolrClientHttpJettySolrClientLBJettySolrClientConcurrentUpdateJettySolrClientHttpJdkSolrClientHttpSolrClientLBHttpSolrClientConcurrentUpdateSolrClient
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).