Frequently Asked Questions - SearchStax

The SearchStax® Frequently Asked Questions page includes the following approved question and answer about our Apache Solr Cloud services.

How do I update the Solr Schema?

Many users have asked how to update the Solr schema file on their deployments.

Uploading a revised schema file as part of a new configuration is easy. The critical part is that changes to field definitions invalidate the collection's index. The index must be wiped and the documents reloaded as part of a schema update. The process occurs in four steps.

1. Update Schema (upload a new configuration to Zookeeper).

When you are ready to deploy your new schema file, simply use zkcli to upload your configuration directory to your Zookeeper ensemble. (See zkcli download instructions.)

Run zkcli in a terminal window:

./zkcli.sh -zkhost <zookeeper URLs> -cmd upconfig -confdir <conf directory> -confname <config name>

where <zookeeper URLs> corresponds to the URLs of the three Zookeeper servers in the deployment details page:
Screenshot
<conf directory> is you local Solr configuration directory (../configsets/basic_configs/conf/); and <config name> is the name of the configuration in Zookeeper (test).

2. Delete Data (delete existing index)

To delete the existing data from your collection, open a terminal window and run the following cURL command:

curl 'https:/<load_balancer_url>/solr/<collection_name>/update?stream.body=<delete><query>*:*</query></delete>&commit=true'

where <load_balancer_URL> is the Solr HTTP Endpoint URL from the deployment details page; Screenshot
and <collection_name> is the name of the Solr collection (testcollection).

The phrase <delete><query>*:*</query></delete> is literal. This query matches all of the records in the collection's index and deletes them.

3. Reload Collection (distribute new configuration from Zookeeper)

The next step is to download the new configuration from the Zookeeper ensemble to the Solr servers.

curl 'https:/<load_balancer_URL>/solr/admin/collections?action=RELOAD&name=<collection_name>'

where <load_balancer_URL> is the Solr HTTP Endpoint URL from the SearchStax dashboard, and <collection_name> is the name of the Solr collection (testcollection).

4. Reload Data (re-ingest documents)

We presume that you already know how to ingest documents, but here's a reminder:

Run the following cURL command from a terminal window.

curl  -X POST -H 'Content-type:application/json' -d <datafile_path> 'https://<load_balancer_URL>/solr/<collection_name>/update?commit=true'

where <load_balancer_URL> is the Solr HTTP Endpoint URL from the deployment details page, <datafile_path> is the location of the document file (@sample.json), and <collection_name> is the name of the Solr collection (testcollection).

We love to answer questions!

Please contact the SearchStax Support Desk immediately if you have any question about Solr Cloud deployments.

Return to Frequently Asked Questions.