Changes a search index for DSE Search configuration.

Modify the search index pending configuration.

Use the RELOAD SEARCH INDEX command to apply changes to the active configuration.

Restriction: Command available only on DSE Search nodes. Running search index management commands on a large datasets may take longer than the CQLSH default timeout of 10 minutes, increase the CQLSH client timeout as required.


ALTER SEARCH INDEX CONFIG ON [keyspace_name.]table_name
   (ADD element_path [attribute_list] WITH $$ json_map $$   
   | SET  element_identifier = 'value'
   | SET shortcut = value
   | DROP element_identifier
   | DROP shortcut)
Table 1. Legend
Syntax conventions Description
UPPERCASE Literal keyword.
Lowercase Not literal.
Italics Variable value. Replace with a user-defined value.
[] Optional. Square brackets ( [] ) surround optional command arguments. Do not type the square brackets.
( ) Group. Parentheses ( ( ) ) identify a group to choose from. Do not type the parentheses.
| Or. A vertical bar ( | ) separates alternative elements. Type any one of the elements. Do not type the vertical bar.
... Repeatable. An ellipsis ( ... ) indicates that you can repeat the syntax element as often as required.
'Literal string' Single quotation ( ' ) marks must surround literal strings in CQL statements. Use single quotation marks to preserve upper case.
{ key : value } Map collection. Braces ( { } ) enclose map collections or key value pairs. A colon separates the key and the value.
<datatype1,datatype2> Set, list, map, or tuple. Angle brackets ( < > ) enclose data types in a set, list, map, or tuple. Separate the data types with a comma.
cql_statement; End CQL statement. A semicolon ( ; ) terminates all CQL statements.
[--] Separate the command line options from the command arguments with two hyphens ( -- ). This syntax is useful when arguments might be mistaken for command line options.
' <schema> ... </schema> ' Search CQL only: Single quotation marks ( ' ) surround an entire XML schema declaration.
@xml_entity='xml_entity_type' Search CQL only: Identify the entity and literal value to overwrite the XML element in the schema and solrConfig files.
Identifies the table of the search index; keyspace name is required when the table is not in the active keyspace.
Identifies the XML path to the setting. Separate child elements using a period. For example:
A comma separated list of attributes value pairs enclosed in braces using the following syntax:
[@attribute_name = 'value', 
@attribute_name = 'value', ... ]
Advanced. Use JSON format to define child elements, such as analyzer tokenizer and filter definitions of field type.
{ "element_name" : [ 
                  { "child_element_name" : { "child_attribute_name" : "value" } } ,
                  { "child_element_name" : { "child_attribute_name" : "value" } }, ... ],
"element_name" : [ 
                  { "child_element_name" : { "child_attribute_name" : "value" } } ,
                  { "child_element_name" : { "child_attribute_name" : "value" } }, ... ], ... }
Identifies the XML path to the setting. To locate an element with specific attribute, use the following syntax.
Shortcuts for configuration elements:
  • autoCommitTime Default value is 10000 ms.
  • defaultQueryField Name of the field. Default not set.
    Note: Use SET to add. Use DROP to remove.
  • directoryFactory Can be used as an alternative to the directoryFactoryClass option. The options are:
    • 'standard'
    • 'encrypted'
  • directoryFactoryClass Specifies the fully-qualified name of the directory factory. Use in place of the directoryFactory option for directory factories other than the standard or encrypted directory factory.
  • filterCacheLowWaterMark Default is 1024 MB.
  • filterCacheHighWaterMark Default is 2048 MB.
  • mergeFactor Default is 10.
  • mergeMaxThreadCount Must configure with mergeMaxMergeCount. Default is the maximum number of concurrent asynchronous indexing threads per DSE Search index as configured by max_solr_concurrency_per_core in dse.yaml.
  • mergeMaxMergeCount Must configure with mergeMaxThreadCount. The default is the calculated value:
    max(max(<maxThreadCount * 2>, <num_tokens * 8>), <maxThreadCount + 5>)
    where num_tokens is the number of token ranges to assign to the virtual node (vnode) as configured in cassandra.yaml.
  • ramBufferSize Default is 512.
  • realtime Default is false.


EBNF syntax:
alterSearchIndex ::= 'ALTER' 'SEARCH' 'INDEX' 'CONFIG'
          'ON' tableName
          ('ADD' elementPath 'WITH' json) |
          ('SET' elementPath('@' attribute)? '=' value) |
          ('DROP' elementPath('@' attribute)?) |
          tableName        ::= (keyspace '.')? table
          elementPath      ::= elementName 
          ('[' '@' attributeName '=' attributeValue 
          (',' '@' attributeName '=' attributeValue)* ']')?
          ( '.' elementName ('[' '@' attributeName '=' attributeValue 
          (',' '@' attributeName '=' attributeValue)* ']')?)*
Railroad diagram:
Figure: alterSearchIndex
Image shows a railroad diagram for the ALTER SEARCH INDEX search CQL command
Figure: tableName
Image shows a railroad diagram of tableName
Figure: elementPath
Image shows a railroad diagram of elementPath


The search index configuration is altered for the wiki.solr keyspace and table, and the specified options.

Enable encryption on search index

To enable encryption on search index using CONFIG shortcut:

ALTER SEARCH INDEX IF NOT EXISTS ON wiki.solr WITH COLUMNS c1,c2 {docValues:true} AND PROFILES spaceSavingAll, spaceSavingNoTextfield AND CONFIG {directoryFactory:'encrypted'};

Auto soft commit max time

To set index configuration with shortcut for automatic soft commit max time to 10000ms:

ALTER SEARCH INDEX CONFIG ON wiki.solr SET autoCommitTime = 10000;

Live indexing

To configure live indexing and reload the altered index:

ALTER SEARCH INDEX CONFIG ON wiki.solr SET autoCommitTime = 100;
ALTER SEARCH INDEX CONFIG ON wiki.solr SET realtime = true;
ALTER SEARCH INDEX CONFIG ON wiki.solr SET ramBufferSize = 2048;

Request handler

Add a configuration request handler

ADD requestHandler[@name='/elevate',@class='solr.SearchHandler', @startup='lazy'] 
WITH  $$ {"defaults":[{"echoParams":"explicit"}],"last-components":["elevator"]} $$;
which adds the requestHandler element to the config:
<requestHandler name="/elevate" class="solr.SearchHandler"> 
   <lst name="defaults">
      <str name="echoParams">explicit</int>
   <arr name="last-components">

Automatic removal of deletes

To extend TieredMergePolicy to support automatic removal of deletes:

ALTER SEARCH INDEX CONFIG ON wiki.solr SET indexConfig.mergePolicyFactory[@class='org.apache.solr.index.AutoExpungeDeletesTieredMergePolicyFactory'].bool[@name='mergeSingleSegments'] = true;
ALTER SEARCH INDEX CONFIG ON wiki.solr SET indexConfig.mergePolicyFactory[@class='org.apache.solr.index.AutoExpungeDeletesTieredMergePolicyFactory'].int[@name='maxMergedSegmentMB'] = 1005;
ALTER SEARCH INDEX CONFIG ON wiki.solr SET indexConfig.mergePolicyFactory[@class='org.apache.solr.index.AutoExpungeDeletesTieredMergePolicyFactory'].int[@name='forceMergeDeletesPctAllowed'] = 25;
If mergeFactor is in the index configuration, you must drop it from the search index before you alter the table to support automatic removal of deletes:
ALTER SEARCH INDEX CONFIG ON wiki.solr DROP indexConfig.mergePolicyFactory;


The location of the dse.yaml file depends on the type of installation:

Package installations
Installer-Services installations


Tarball installations
Installer-No Services installations