Search code examples
collectionssolrschemamanaged

solr - programmatically create a new collection


I installed solr 5.3 and ran solr in solr cloud mode. I easily created a new collection in the managed schema mode at the command prompt solr create -c new_collection this creates a new folder and updates the schema settings for me

I then tried to dup this process programmatically using the collection API https://cwiki.apache.org/confluence/display/solr/Collections+API

I can't CREATE a new collection. get error about config not found i tried to CREATE a new config using the managedschema as a base but that didn't work.

what is the proper way to programmatically create a new collection?


Solution

  • Solr cloud stores its config into zookeeper, so you should upload to it a config files (must contains a schema.xml and solrconfig.xml). That files are stored under path configs/collection_name. You can upload files via zookeeper client lib or via zookeeper cli, read more about it at Using ZooKeeper to Manage Configuration Files