This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.
Please note comments on these pages have now been disabled for all users.
Solr's Schema API enables remote clients to access schema information, and make schema modifications, through a REST interface. Other features such as Solr's Schemaless Mode also work via schema modifications made programatically at run time.
Using the Managed Schema is required to be able to use the Schema API to modify your schema. However, using Managed Schema does not by itself mean you are also using Solr in Schemaless Mode (or "schema guessing" mode). Schemaless mode requires enabling the Managed Schema if it is not already, but full schema guessing requires additional configuration as described in other sections of this Guide.
While the "read" features of the Schema API are supported for all schema types, support for making schema modifications programatically depends on the
<schemaFactory/> in use.
<schemaFactory/> is not explicitly declared in a
solrconfig.xml file, Solr implicitly uses a
ManagedIndexSchemaFactory, which is by default
"mutable" and keeps schema information in a
If you wish to explicitly configure
ManagedIndexSchemaFactory the following options are available:
mutable- controls whether changes may be made to the Schema data. This must be set to true to allow edits to be made with the Schema API.
managedSchemaResourceNameis an optional parameter that defaults to "managed-schema", and defines a new name for the schema file that can be anything other than "
With the default configuration shown above, you can use the Schema API to modify the schema as much as you want, and then later change the value of
mutable to false if you wish to "lock" the schema in place and prevent future changes.
An alternative to using a managed schema is to explicitly configure a
ClassicIndexSchemaFactory requires the use of a
schema.xml configuration file, and disallows any programatic changes to the Schema at run time. The
schema.xml file must be edited manually and is only loaded only when the collection is loaded.
schema.xmlto Managed Schema
If you have an existing Solr collection that uses
ClassicIndexSchemaFactory, and you wish to convert to use a managed schema, you can simplify modify the
solrconfig.xml to specify the use of the
ManagedIndexSchemaFactory. Once Solr is restarted and it detects that a
schema.xml file exists, but the
managedSchemaResourceName file (ie: "
managed-schema") does not exist, the existing
schema.xml file will be renamed to
schema.xml.bak and the contents are re-written to the managed schema file. If you look at the resulting file, you'll see this at the top of the page:
You are now free to use the Schema API as much as you want to make changes, and remove the
If you have started Solr with managed schema enabled and you would like to switch to manually editing a
schema.xml file, you should take the following steps:
solrconfig.xmlto replace the
ManagedIndexSchemaFactorydefinition if it exists.
ClassicIndexSchemaFactorydefinition as shown above
If you are using SolrCloud, you may need to modify the files via ZooKeeper. The
bin/solr script provides an easy way to download the files from ZooKeeper and upload them back after edits. See the section ZooKeeper Operations for more information.
To have full control over your
schema.xml file, you may also want to disable schema guessing, which allows unknown fields to be added to the schema during indexing. The properties that enable this feature are discussed in the section Schemaless Mode.