Configsets

Configsets are a set of configuration files used in a Solr installation: solrconfig.xml, the schema, and then resources like language files, synonyms.txt, DIH-related configuration, and others that are referenced from the config or schema.

Such configuration, configsets, can be named and then referenced by collections or cores, possibly with the intent to share them to avoid duplication.

Solr ships with two example configsets located in server/solr/configsets, which can be used as a base for your own. These example configsets are named _default and sample_techproducts_configs.

Configsets in Standalone Mode

If you are using Solr in standalone mode, configsets are managed on the filesystem.

Each Solr core can have it’s very own configSet located beneath it in a <instance_dir>/conf/ dir. Here, it is not named or shared and the word configset isn’t found. In Solr’s early years, this was the only way it was configured.

To create a named configset, add a new directory under the configset base directory. The configset will be identified by the name of this directory. Then add a conf/ directory containing the configuration you want to share. The structure should look something like this:

/<configSetBaseDir>
    /configset1
        /conf
            /managed-schema
            /solrconfig.xml
    /configset2
        /conf
            /managed-schema
            /solrconfig.xml

The default base directory is $SOLR_HOME/configsets. This path can be configured in solr.xml (see Format of solr.xml for details).

To create a new core using a configset, pass configSet as one of the core properties. For example, if you do this via the CoreAdmin API:

V1 API

curl http://localhost:8983/admin/cores?action=CREATE&name=mycore&instanceDir=path/to/instance&configSet=configset2

V2 API

curl -v -X POST -H 'Content-type: application/json' -d '{
  "create":[{
    "name": "mycore",
    "instanceDir": "path/to/instance",
    "configSet": "configSet2"}]}'
    http://localhost:8983/api/cores

Configsets in SolrCloud Mode

In SolrCloud, it’s critical to understand that configsets are fundamentally stored in ZooKeeper and not the file system. Solr’s _default configset is uploaded to ZooKeeper on initialization. This and some demonstration ones remain on the file system but Solr does not use them whatsoever in this mode.

When you create a collection in SolrCloud, you can specify a named configset — possibly shared. If you don’t, then the _default will be copied and given a unique name for use by this collection.

A configset can be uploaded to ZooKeeper either via the Configsets API or more directly via bin/solr zk upconfig. The Configsets API has some other operations as well, and likewise, so does the CLI.

To upload a file to a configset already stored on ZooKeeper, you can use bin/solr zk cp.

By default, ZooKeeper’s file size limit is 1MB. If your files are larger than this, you’ll need to either increase the ZooKeeper file size limit or store them instead on the filesystem.