Property Substitution in Configuration Files

Solr supports variable substitution of property values in configuration files, which allows runtime specification of various configuration options in solrconfig.xml.

The syntax is ${propertyname[:option default value]}. This allows defining a default that can be overridden when Solr is launched. If a default value is not specified, then the property must be specified at runtime or the configuration file will generate an error when parsed.

There are multiple methods for specifying properties that can be used in configuration files. Of those below, strongly consider "config overlay" as the preferred approach, as it stays local to the configset and is easy to modify.

JVM System Properties

Any JVM system property, usually specified using the -D flag when starting the JVM, can be used as variables in any XML configuration file in Solr.

For example, in the sample solrconfig.xml files, you will see this value which defines the locking type to use:


Which means the lock type defaults to "native" but when starting Solr you could override this using a JVM system property by launching Solr with:

bin/solr start -Dsolr.lock.type=none

In general, any Java system property that you want to set can be passed through the bin/solr script using the standard -Dproperty=value syntax.

Alternatively, you can add common system properties to the SOLR_OPTS environment variable defined in the Solr include file (bin/ or bin/ For more information about how the Solr include file works, refer to: Taking Solr to Production.

Config API to Override solrconfig.xml

The Config API allows you to use an API to modify Solr’s configuration, specifically user defined properties. Changes made with this API are stored in a file named configoverlay.json. This file should only be edited with the API, but will look like this example:


For more details, see the section Config API.

User-Defined Properties in

Every Solr core has a file, automatically created when using the APIs. When you create a SolrCloud collection, you can pass through custom parameters by prefixing the parameter name with as a parameter.

For example, to add a property named "my.custom.prop":




curl -X POST -H 'Content-type: application/json' -d '{"create": {"name": "gettingstarted", "numShards": "1", "": "edismax"}}' http://localhost:8983/api/collections

This will create a file that has at least the following properties (others omitted for brevity):

The my.custom.prop property can then be used as a variable, such as in solrconfig.xml:

<requestHandler name="/select">
  <lst name="defaults">
    <str name="defType">${my.custom.prop}</str>

Implicit Core Properties

Several attributes of a Solr core are available as "implicit" properties that can be used in variable substitution, independent of where or how the underlying value is initialized.

For example, regardless of whether the name for a particular Solr core is explicitly configured in or inferred from the name of the instance directory, the implicit property is available for use as a variable in that core’s configuration file:

<requestHandler name="/select">
  <lst name="defaults">
    <str name="collection_name">${}</str>

All implicit properties use the solr.core. name prefix, and reflect the runtime value of the equivalent property:


  • solr.core.config

  • solr.core.schema

  • solr.core.dataDir

  • solr.core.transient

  • solr.core.loadOnStartup