gbraun gbraun -3 years ago 181
Groovy Question

solr enable managed schema with script

I need to change the schema from .xml to managed schema on several solr servers, unfortunately it has to be done with some sort of groovy script (can do curls) that will run once automatically when it gets deployed. This is because of our deployment strategy we can't modify the files on the servers. A colleague told me this was possible, but I have read about the managed schema API and now I am wondering if that's even possible, because there was not mentioned anything about such a feature.

Answer Source

Changing between the Classic Scheme and the Managed Scheme is a setting in the configuration file for your Solr instances, and is not something you can change through the web interface as far as I know.

See Schema Factory Definition in SolrConfig:

When a 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 managed-schema file.

<!-- An example of Solr's implicit default behavior if no
     no schemaFactory is explicitly defined.
<schemaFactory class="ManagedIndexSchemaFactory">
   <bool name="mutable">true</bool>
   <str name="managedSchemaResourceName">managed-schema</str>

This assumes you're using a recent enough version of Solr that actually provides support for the Schema API and using the managed schema.

If your servers are configured to use the managed schema, adding fields and changing the schema definition is doable through the API with cURL or other HTTP libraries.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download