0

Does anyone have any experience adding computed fields to a managed schema? I'm using Solr in SolrCloud mode with 1 node. My Sitecore 10.2 setup uses docker with a solr-init and solr image. I'm able to add a new field with the add-field command, but I don't see anything in the extended properties for a computed field. Here is the regular add-field command:

curl -X POST -H "Content-type:application/json" --data-binary "{\"add-field\":{\"name\":\"TEST\",\"type\":\"string\",\"required\":\"true\",\"stored\":true,\"indexed\":\"true\"}}" 

http://localhost:8984/api/cores/sitecore_test_index_shard1_replica_n1/schema

If it can't be done with the API is there another way? Or do I have to convert the managed schema back to classic schema.xml?

Thanks!

1 Answer 1

1

The Solr Schema API is recommended in Solr documentation, but it's not very easy to use. Since you are using docker, I'm assuming that you need to make these changes whenever your containers are initialized.

You might consider manually updating the schema file via text editor or from Solr admin, saving the updated file and then uploading the adjusted schema to SolrCloud/Zookeeper on initialization.

If you're using SearchStax, there are detailed instructions here:

https://www.searchstax.com/docs/hc/update-solr-schema/

3
  • Unfortunately, there is no schema to edit. With SolrCloud there is a managed schema. I've run into all kinds of issues trying to run the scripts in solr-init to upload the managed schema file. Several post in the exchange with other users unable to upload a custom file. I was hoping the API would do the trick. It's sounding more like I should set it to classic mode (back to schema.xml) and bail on the managed schema. Commented Jan 26, 2022 at 1:21
  • Wouldn't you still have to upload the schema.xml file during solr-init? If it works, cool, but unfortunately not a great solution for a future production environment. :( Commented Jan 26, 2022 at 15:51
  • 1
    Ended up going with the zookeeper cli. Will use the schema api for simple updates. Commented Jan 27, 2022 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.