20

I have below questions in solr 6.

  1. What is the main difference between managed-schema and schema.xml
  2. What are the benefits and disadvantages while using managed-schema and schema.xml(classic).

And could you please help me in understanding what is recommended in solr6?

Regards,

Shaffic

Shafs Jan
  • 400
  • 1
  • 3
  • 13
  • Its naming convention they followed for solr 6. instead of schema the named changed to managed-schema. its purpose is same. – Vinod Oct 05 '16 at 10:41

2 Answers2

20

I've done some investigation after wondering the same thing and here's the best I can come up with.

It seems that schema.xml and managed-schema are indentical, only their name changed in Solr6.

Benefits of managed-schema

  • The benefits are that you can more safely make changes to your schema without fear of making typos or creating an invalid schema. The API would reject your changes if something is invalid.
  • The Schema API also handles all of the reloading of your cores after the schema has changed so you don't have to.

Drawbacks of managed-schema

  • You shouldn't make manual edits to the managed-schema and therefore you should go through the API, this makes it harder to keep track of the current state of your schema (e.g. via Version Control)

    Note: The Schema API has an endpoint to get the managed-schema with a special param curl http://localhost:8983/solr/<COLLECTION>/schema?wt=schema.xml

Note: If you have a schema.xml file and do not have a managed-schema at the time of starting Solr and do not have schemaFactory specified in your solrconfig.xml file, Solr will assume it is managed, and create a managed_schema from your schema.xml file, at which point your schema.xml file is no longer read from. The managed-schema will be read from at this point forward. Further changes to schema.xml will be ignored.

Brandon Deo
  • 4,195
  • 4
  • 25
  • 42
5

From the Solr 6.6 reference documentation:

  • managed-schema is the name for the schema file Solr uses by default to support making Schema changes at runtime via the Schema API, or Schemaless Mode features. You may explicitly configure the managed schema features to use an alternative filename if you choose, but the contents of the files are still updated automatically by Solr.

  • schema.xml is the traditional name for a schema file which can be edited manually by users who use the ClassicIndexSchemaFactory.

If you want to manually edit your schema(although not recommended) using schema.xml instead of through schema api as managed-schema, you can do so by setting the schemaFactory configuration in solrconfig.xml :
<schemaFactory class="ClassicIndexSchemaFactory"/>

Give this link a quick read to have all your questions clearly answered.

yetAnotherCoder
  • 111
  • 2
  • 7