Quarkus Solr
Apache Solr is the open source, multi-modal search platform built on the full-text, vector, and geospatial search capabilities of Apache Lucene. This extension integrates Solr into Quarkus via the SolrJ client library, and provides dev services, Dev UI tooling, and observability out of the box.
It provides the following features:
-
Automatic Solr dev service for local development and testing
-
Injected SolrJ
SolrClientbeans, pre-configured fromapplication.properties -
Dev UI card with Solr Admin UI link
-
MCP tool exposure of all Dev UI operations for use with AI assistants
-
Native compilation support
-
Integration with the Quarkus observability stack (health, metrics, logging)
Installation
Add the io.quarkiverse.solr:quarkus-solr extension to your build file.
With Maven:
<dependency>
<groupId>io.quarkiverse.solr</groupId>
<artifactId>quarkus-solr</artifactId>
<version>1.1.0</version>
</dependency>
Using SolrJ in your application
Inject SolrClient wherever you need to interact with Solr:
import org.apache.solr.client.solrj.SolrClient;
@ApplicationScoped
public class SolrService {
@Inject
SolrClient solrClient;
public SolrDocumentList query(String query) throws SolrServerException, IOException {
SolrQuery solrQuery = new SolrQuery();
solrQuery.setQuery(query);
return solrClient.query("my-collection", solrQuery).getResults();
}
}
The SolrClient bean has @Dependent scope, meaning each injection point gets its own client instance.
This is intentional: you can safely apply per-use-case configuration to one injected client without affecting others.
The underlying client type depends on the configuration:
-
Single node / HTTP:
HttpJdkSolrClient— used when a single URL is configured -
SolrCloud / ZooKeeper:
CloudHttp2SolrClient— used when multiple URLs are configured orquarkus.solr.cloud=true
See the SolrJ documentation for details on querying and indexing documents.
Dev Services for Solr
When running in dev or test mode without a quarkus.solr.url configured, the extension automatically starts a
containerised Solr instance via Docker. A collection named dummy is created by default.
# No configuration needed for dev mode — the dev service handles it.
# For production, set:
quarkus.solr.url=http://localhost:8983/solr
See Customize Dev-Service for how to change the image, collection name, and configuration.
SolrCloud
The extension supports SolrCloud (ZooKeeper-based) clusters. Cloud mode activates automatically when you configure multiple node URLs, or you can force it explicitly:
# Multiple nodes — cloud mode is selected automatically
quarkus.solr.url=http://solr1:8983/solr,http://solr2:8983/solr
# Or force cloud mode with a single ZooKeeper URL
quarkus.solr.cloud=true
quarkus.solr.url=zookeeper-host:2181/solr
Key SolrCloud configuration properties:
| Property | Description |
|---|---|
|
Force |
|
ZooKeeper session timeout (ms) |
|
ZooKeeper connection timeout (ms) |
|
How long to cache collection state (ms) |
|
Refresh collection cache entries in parallel |
|
Send updates to all replicas in parallel |
|
Enable ZooKeeper ACL support |
See the Solr ZooKeeper documentation for background on SolrCloud topology.
Dev UI
When running in dev mode, a Solr card is available in the Quarkus Dev UI at /q/dev-ui. Beside general information about the extension, it provides a link to the Solr Admin UI.
See Dev UI & MCP for full details.
Observability
Logging
All Solr interactions are logged at DEBUG level. Request and response details are logged at TRACE level.
Enable them in application.properties:
quarkus.log.category."io.quarkiverse.solr".level=DEBUG
# For full request/response details:
quarkus.log.category."io.quarkiverse.solr".level=TRACE
Health
If quarkus-smallrye-health is on the classpath, a readiness check is automatically registered. It verifies that the Solr instance is reachable. The check can be disabled:
quarkus.solr.health-enabled=false
Metrics
If quarkus-micrometer-registry-prometheus is on the classpath, timers and counters are automatically registered for all Solr requests.
Extension Configuration Reference
Configuration property fixed at build time - All other configuration properties are overridable at runtime
Configuration property |
Type |
Default |
|---|---|---|
Is solr health check enabled Environment variable: |
boolean |
|
If DevServices has been explicitly enabled or disabled. DevServices is generally enabled by default, unless there is an existing configuration present. When DevServices is enabled Quarkus will attempt to automatically configure and start a solr instance when running in Dev or Test mode and when Docker is running. Environment variable: |
boolean |
|
The container image name to use, for container based DevServices providers. If not set, the default solr image in the version of solrj will be used Environment variable: |
string |
|
Optional fixed port the dev service will listen to. If not defined, the port will be chosen randomly. Environment variable: |
int |
|
The name of the collection to be created in Solr If not defined, a collection names "dummy" will be created Environment variable: |
string |
|
Custom configuration to be used. Must be a directory on the classpath containing at least a solrconfig.xml If not set, default configuration of Solr docker container is used Environment variable: |
string |
|
The value of the label attached to the started container. This property is used when This property is used when you need multiple shared Solr instances. Environment variable: |
string |
|
Indicates if the instance managed by Quarkus Dev Services is shared. When shared, Quarkus looks for running containers using label-based service discovery. If a matching container is found, it is used, and so a second one is not started. Otherwise, Dev Services starts a new container. The discovery uses the Container sharing is only used in dev mode. Environment variable: |
boolean |
|
One or more Solr URLs, which the client then uses to send HTTP requests to Solr. These URLS must point to the root Solr path (i.e. "/solr"). If multiple URLs are configured, it is assumed that Solr Cloud Mode is used and these URLs are used to fetch information about the layout and health of the Solr cluster. If only one URL is defined, the URLs is used to send user-provided requests using Environment variable: |
list of string |
required |
Default collection to be used Most SolrClient methods allow users to specify the collection or core they wish to query, etc. as a String parameter. However, continually specifying this parameter can become tedious, especially for users who always work with the same collection. Users can avoid this pattern by specifying a "default" collection If specified SolrClients will use this default for making requests whenever a collection or core is needed (and no overriding value is specified) Environment variable: |
string |
|
Should HTTP 1.1 be used instead of HTTP/2? If not set, HTTP/2 is used by default Environment variable: |
boolean |
|
Request timeout in milliseconds If not set, idle timeout is used Environment variable: |
long |
|
Idle timeout in milliseconds If not set, Environment variable: |
long |
|
Connection timeout in milliseconds If not set, Environment variable: |
long |
|
Should the client follow redirects? If not set, redirect are not followed Environment variable: |
boolean |
|
Maximal number of connections per host If not set, Environment variable: |
int |
|
The username Environment variable: |
string |
required |
The password Environment variable: |
string |
required |
The proxy host Environment variable: |
string |
required |
The proxy port Environment variable: |
int |
|
Is this a socks4 proxy? Environment variable: |
boolean |
|
Is this proxy using HTTPS Environment variable: |
boolean |
|
Force SolrCloud mode If set, it is assumed that Solr Cloud Mode is used even if only one Environment variable: |
boolean |
|
Zookeeper client timeout in milliseconds Only relevant if Solr Cloud Mode is used even. If not set, Environment variable: |
int |
|
Zookeeper connection timeout in milliseconds Only relevant if Solr Cloud Mode is used. If not set, Environment variable: |
int |
|
Can Zookeepers ACL be used Only relevant if Solr Cloud Mode is used. See documentation for details. If not set,SolrJ’s default value (true) is used. Environment variable: |
boolean |
|
Cache ttl for cached objects in seconds Only relevant if Solr Cloud Mode is used. If not set,SolrJ’s default value (60s) is used. Environment variable: |
int |
|
Number of parallel collection state refresh operations to run in parallel Only relevant if Solr Cloud Mode is used. If not set,SolrJ’s default value (5) is used. Environment variable: |
int |
|
Time to wait to re-fetch the state after getting the same state version from Zookeeper in milliseconds Only relevant if Solr Cloud Mode is used. If not set,SolrJ’s default value (3000) is used. Environment variable: |
long |
|
Should shard updates be sent in parallel Only relevant if Solr Cloud Mode is used. When an UpdateRequest affects multiple shards, CloudSolrClient splits it up and sends a request to each affected shard. This setting chooses whether those sub-requests are sent serially or in parallel. If not set,SolrJ’s default value ('true') is used. Environment variable: |
boolean |