You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2022/05/25 21:25:09 UTC

Create a core via SolrClient, single server

All,

I have a non-clustered/ZK Solr instance and I'd like to create a core 
using the Java SolrClient library. Is that currently possible? I only 
see methods for working with documents in the current core (selected 
when the client object is initially created, based upon the URL which 
contains the core name).

I'm using Solr 7.7.3 and the vanilla SolrJ client library.

Thanks,
-chris

Re: Create a core via SolrClient, single server

Posted by Shawn Heisey <ap...@elyograg.org>.
On 5/25/2022 3:25 PM, Christopher Schultz wrote:
> I have a non-clustered/ZK Solr instance and I'd like to create a core 
> using the Java SolrClient library. Is that currently possible? I only 
> see methods for working with documents in the current core (selected 
> when the client object is initially created, based upon the URL which 
> contains the core name).

With the default config, you have to create the core directory and its 
conf subdirectory with a config, schema, and any other config files 
referenced by the config and schema ... then you can call the CoreAdmin 
API to add the core.

When using "bin/solr create" that script creates the core directory and 
populates the conf with the config you specify, then it calls the 
CoreAdmin API to add the core to Solr.

There is a ConfigSet feature for non-cloud ... once properly set up, 
that would allow core creation using ONLY the API.  I haven't used that 
feature myself.  The sticky point is that in order to create a core, the 
config must be available.  In cloud mode, all configs are in zookeeper, 
so Solr just has to create the directory.  For non-cloud either the core 
directory must already exist and have a config, or the config must be 
referenced via the configset feature.

Thanks,
Shawn