On 6/1/2022 11:41 AM, Christopher Schultz wrote:
How can I provide the schema for the core once it's been created? Can
I use the API for that, or do I have to resort to pushing the config
file directly similar to these kindx of curl commands:
curl -d "{ ... config }" \
${SCHEME}://localhost:${PORT}/solr/${CORENAME}/config
curl -H application/json --data-binary '{ ... schema ... }' \
"${SCHEME}://localhost:${PORT}/solr/${CORENAME}/schema"
There's a chicken and egg problem. You can't use those endpoints until
the core is created. And you can't create the core without providing
the config and schema.
https://solr.apache.org/guide/8_9/coreadmin-api.html#coreadmin-create
(the large WARNING box in this section of the docs is the part I am
referring you to)
Assuming you're not going to be using cloud mode (in which case all
configs are in zookeeper) you have two choices: Create the core
directory with a conf subdirectory that contains a config and a schema
before calling the CoreAdmin API, or use the ConfigSets feature.
https://solr.apache.org/guide/8_9/config-sets.html#configsets-in-standalone-mode
Checking SolrJ, you would use createCore("corename", "corename", client)
if go you with the first option and name the directory "corename" in the
solr home. It doesn't look like CoreAdminRequest has a convenience
method for using a configSet when creating a core.
I worked out how to do it as a generic request with SolrJ if you want to
use the configsets feature:
https://paste.elyograg.org/view/3cd9aac2
Thanks,
Shawn