DSE Search index quickstart

This quickstart provides an overview of creating and altering DSE Search indexes using CQL index management commands.

  1. Connect CQL shell (cqlsh) to a DSE Search node, and then create a tutorial keyspace:

    CREATE KEYSPACE demo WITH
       replication = {
          'class': 'SimpleStrategy',
          'replication_factor': 1};
  2. Create a table and search index:

    CREATE TABLE demo.users (
       userid uuid,
       firstname text,
       lastname text,
       email text,
       created_date timestamp,
       PRIMARY KEY (userid));
    
    CREATE SEARCH INDEX ON demo.users;

    A new search index is generated on the table. Existing data is reindexed.

  3. Use the CQL shell DESCRIBE SEARCH INDEX SCHEMA command to view the pending search index schema:

    <schema name="autoSolrSchema" version="1.5">
      <types>
        <fieldType class="org.apache.solr.schema.TextField" name="TextField">
          <analyzer>
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
          </analyzer>
        </fieldType>
        <fieldType class="org.apache.solr.schema.UUIDField" name="UUIDField"/>
        <fieldType class="org.apache.solr.schema.TrieDateField" name="TrieDateField"/>
      </types>
      <fields>
        <field indexed="true" multiValued="false" name="firstname" stored="true" type="TextField"/>
        <field docValues="true" indexed="true" multiValued="false" name="userid" stored="true" type="UUIDField"/>
        <field indexed="true" multiValued="false" name="email" stored="true" type="TextField"/>
        <field indexed="true" multiValued="false" name="lastname" stored="true" type="TextField"/>
        <field docValues="true" indexed="true" multiValued="false" name="created_date" stored="true" type="TrieDateField"/>
      </fields>
      <uniqueKey>userid</uniqueKey>
    </schema>
  4. To increase tolerance of non-ASCII characters in the name field, add a new fieldType to the schema with the following ALTER SEARCH INDEX SCHEMA statement.

    Double dollar signs ($$) are dollar quotes that are used to escape a single quotation mark.

    ALTER SEARCH INDEX SCHEMA ON demo.users
       ADD types.fieldType [
          @name='TextField_intl' ,
          @class='org.apache.solr.schema.TextField' ]
       WITH  $${
          "analyzer": [ {
             "type": "index",
             "tokenizer": { "class": "solr.StandardTokenizerFactory" },
             "filter": [ { "class": "solr.LowerCaseFilterFactory" },
                  { "class": "solr.ASCIIFoldingFilterFactory" }
                ]
              },
              {
                "type": "search",
                "tokenizer": { "class": "solr.StandardTokenizerFactory" },
                "filter": [
                  { "class": "solr.LowerCaseFilterFactory" },
                  { "class": "solr.ASCIIFoldingFilterFactory" }
                ]
              }
            ]
          }$$;
  5. Run DESCRIBE SEARCH INDEX SCHEMA again to view the updated schema.

    The new fieldType has separate index and search analysis phases:

    <fieldType class="org.apache.solr.schema.TextField" name="TextField_intl">
      <analyzer type="index">
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.ASCIIFoldingFilterFactory"/>
        <tokenizer class="solr.StandardTokenizerFactory"/>
      </analyzer>
      <analyzer type="search">
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.ASCIIFoldingFilterFactory"/>
        <tokenizer class="solr.StandardTokenizerFactory"/>
      </analyzer>
    </fieldType>
  6. Change the type on the firstname and lastname fields:

    ALTER SEARCH INDEX SCHEMA ON demo.users
      SET field[@name='firstname']@type = 'TextField_intl';
    ALTER SEARCH INDEX SCHEMA ON demo.users
      SET field[@name='lastname']@type = 'TextField_intl';

    All changes made with ALTER SEARCH INDEX affect only the pending resources for the search index.

  7. To apply the pending changes, reload the index:

    RELOAD SEARCH INDEX ON demo.users;

    If there is existing data in the index, rebuild the index:

    REBUILD SEARCH INDEX ON demo.users;

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2026 | Privacy policy | Terms of use |  Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: Contact IBM