How to add collections to solr core?
Solution 1
It's very easy, just copy/paste exist collection, and rename this copy, for instance collection2. Also do not forget edit core.properties file, put there new collection's name.
Solution 2
Core and Collection is basically the same where you would hold the information pertaining to different unrelated entities.
You would have different Cores/Collections for e.g. Documents, People, News etc...
You can always club information within the same Core/Collection e.g. Document & People etc.
It would really depend on how you index your data and what the requirements are.
You need to check Solr Multicore feature, which allows you to setup multiple cores/collections
You can find multiple blogs about Multicore setup
You can download the book from LucidWorks as well for more detailed information
Solution 3
if your one collection is present inside example/solr directory, then you can create another collection inside the same example/solr directory. Do note that it is not strictly multicore since all the collections are present inside the same core and so all the collections will share the same solr.war file. The collections directory would have their own subdirectories :- conf and data. Also, each collection should have its own schema.xml and solrconfig.xml
for example, assume you have two collections :- collection1 and collection2 inside example/solr directory. Then you can call them by :-
http://localhost:8983/solr/collection1/select?parameters
http://localhost:8983/solr/collection2/select?parameters
once you have created all the collections, you will have to modify the solr.xml file in example/solr directory. Look to the core child tag in cores name xml tag and add the new collection there.
<core name="collection1" instanceDir="collection1" />
<core name="collection2" instanceDir="collection2" />
The instanceDirs are the name of the directories in which your cores are present.
Solution 4
The best way is to create it from console with:
solr create -с collection2
In linux you should run it from solr user
sudo su - solr -c "/opt/solr/bin/solr create -c collection2"
Manojak
Updated on June 04, 2022Comments
-
Manojak almost 2 years
I want to add one more collection to solr core. I need blogs for examples and suggestions.
I am using Tomcat 7 and Ubuntu for this.
Though it is mentioned in the wikies about how to install Solr and create cores, there's no complete view about how to create collection under the same core.
How to add Solr collection in this case?
-
Andrei Diaconescu about 11 yearscan you please say how to create a new collection . you say "once you have created all the collections" but the problem is just that: how to create a new collection. Do i need to duplicate the folder of collection1 and rename it to collection2 ?
-
Max about 11 yearsyup. that is it. copy the collection1 directory and rename it to collection2. each collection will have its own schema and solrconfig file. Once that is setup, then edit your solr.xml.
-
Sergey almost 9 yearsCopy-paste from where to where?