Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to create schema.xml when creating a new core in Solr?

Tags:

solr

I am running Solr 5.3.0 and I have created a new core using the command bin/solr create -c collection1.

However, I noticed there is no schema.xml file anywhere for that core in the collection1/conf folder.

Do I need to create the schema.xml from scratch each time I create a new core?

What is the best way to do this? Copy the one from {SOLR_INSTALLATION}/server/solr/configsets\basic_configs\conf and modify the schema.xml to suit my needs?

Thanks

like image 377
Marc Thomas Avatar asked Oct 02 '15 10:10

Marc Thomas


Video Answer


2 Answers

Solr 5.3 by default will create a managed schema without a schema.xml; you will then need to create everything you need in it via REST calls to Solr. You can read more about it here.

If you wanted to have the actual schema file you will need to create your collection like so:

bin/solr create -c collection1 -d {SOLR_INSTALLATION}/server/solr/configsets/basic_configs

You can learn more about the options to create a collection by doing:

bin/solr create_collection help

like image 53
nick_v1 Avatar answered Sep 23 '22 08:09

nick_v1


Solr 5 creates schema automatically for you and it is known as managed schema In case you need to specify your own schema then you can use the below curl command

curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field": {"name":"order_count", "type":"int", "multiValued":false, "stored":true}}'

name : the name of your column or field

type : data type of field

Similarly you can run curl commands for all the fields
You can run this command after creating your solr collection using solr create -c command

like image 31
Cpt Kitkat Avatar answered Sep 22 '22 08:09

Cpt Kitkat