Class SolrCommitter

All Implemented Interfaces:
BatchConsumer, Committer, Configurable<SolrCommitterConfig>, AutoCloseable

public class SolrCommitter extends AbstractBatchCommitter<SolrCommitterConfig>

Commits documents to Apache Solr (and Solr-based products, such as LucidWorks Fusion). It sends JSON update requests over HTTP and does not depend on the SolrJ library.

Connection mode

The Solr URLs to send documents to are specified as nodes. Each is a Solr "core" or "collection" URL, such as http://localhost:8983/solr/mycollection. The connectionMode defines how they are used:

SINGLE_NODE
Direct access to a single Solr node. Default with one node.
LOAD_BALANCED
Simple load-balancing as an alternative to an external load balancer. Default with several nodes. Updates are spread across nodes. A failing node is set aside for a while and the request is sent to another one.
CLOUD
For use with a SolrCloud cluster. Each node URL ends with the collection name. The nodes currently hosting the collection are discovered over HTTP (Collections API CLUSTERSTATUS) and refreshed periodically, so ZooKeeper does not have to be reachable. Updates are spread across these nodes. If the cluster state cannot be obtained (e.g., missing permission) or discovered nodes are unreachable, the configured nodes are used. ZooKeeper connection strings are not supported.

The httpVersion is AUTO by default: HTTP/2 is used with "https" URLs, HTTP/1.1 otherwise.

Deprecated: solrClientType (SolrJ client names) and solrURL (comma-separated URLs) are replaced by connectionMode, httpVersion and nodes. They are still honored for now.

Authentication

The following are supported, and sent with every request to Solr:

  • Basic authentication: with credentials (password can be encrypted).
  • Bearer token: with bearerToken (e.g., for the Solr JWT authentication plugin). Ignored when basic credentials are set.
  • Custom HTTP headers: with headers (e.g., for an API gateway or a reverse proxy). These can override the Authorization header set by the above.
  • TLS: for HTTPS, the JVM default trust store is used (customizable with the standard javax.net.ssl.* system properties, including for client certificates).

HTTP proxies are those of the JVM (standard http.proxyHost and https.proxyHost system properties). Kerberos authentication is not supported.