DataStax Enterprise 3.1 Documentation

Creating a Solr index

This documentation corresponds to an earlier product version. Make sure this document corresponds to your version.

Latest DSE documentation | Earlier DSE documentation

A minimal Solr installation requires these files:

  • Schema.xml

    Describes the fields to index in Solr and types associated with them. These fields map to Cassandra columns. To route search requests to the appropriate nodes, the schema needs a unique key.

  • Solrconfig.xml

    Holds configuration information for query handlers and Solr-specific caches.

After writing a schema.xml you HTTP-post the solrconfig.xml and the schema.xml to a Solr node in your DataStax Enterprise cluster. Next, you create a new Solr core (or reload an existing core) to create (or recreate) an index on a table for searching Cassandra data.

Indexing guidelines

You can avoid problems by following these recommendations:

  1. When users post schema or configuration files simultaneously, schema disagreements can occur. This causes Solr errors.

    Do not make schema changes on hot production systems

  2. While Solr is indexing, do not truncate a table that Solr has indexed.

    You can check indexing status using the Solr Admin.

Uploading the schema and configuration

This procedure describes how to create a Solr index by posting the solrconfig.xml and schema.xml and creating the Solr core. In Example Using CQL you can follow similar steps to actually create a Solr index and insert data into Solr and Cassandra.

  1. Post the configuration file using the cURL utility:

    curl http://localhost:8983/solr/resource/<keyspace.table>/solrconfig.xml
      --data-binary @solrconfig.xml -H 'Content-type:text/xml; charset=utf-8'
  2. Post the schema file:

    curl http://localhost:8983/solr/resource/<keyspace.table>/schema.xml
      --data-binary @schema.xml -H 'Content-type:text/xml; charset=utf-8'

Creating a Solr core

You cannot create a Solr core unless you first upload the schema and configuration files.

Use this command create a Solr core.

curl "http://localhost:8983/solr/admin/cores?action=CREATE&name=<keyspace.table>"

Creating a Solr core on one node automatically creates the core other Solr nodes, and DSE Search stores the files on all the Cassandra nodes.