ALTER SEARCH INDEX CONFIG

Changes a search index for DSE Search configuration.

cassandra.yaml

The location of the cassandra.yaml file depends on the type of installation:
Package installations /etc/dse/cassandra/cassandra.yaml
Tarball installations installation_location/resources/cassandra/conf/cassandra.yaml

Modify the search index pending configuration.

Use the CQL shell command DESCRIBE SEARCH INDEX to view the pending and active search index. 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 large datasets can take longer than the CQLSH default timeout of 10 minutes. Increase the CQLSH client timeout as required.

Synopsis

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.
keyspace_name.table_name
Identifies the table of the search index; keyspace name is required when the table is not in the active keyspace.
element_path
Identifies the XML path to the setting. Separate child elements using a period. For example:
types.fieldTypes
attribute_list
A comma-separated list of attributes value pairs enclosed in braces using the following syntax:
[@attribute_name = 'value', 
@attribute_name = 'value', ... ]
json_map
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" } }, ... ], ... }
element_identifier
Identifies the XML path to the setting. To locate an element with specific attribute, use the following syntax.
element_name[@attribute_name='value']
shortcut
Shortcuts to configuration element values using SET:
  • autoCommitTime Default value is 10000.
  • 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'
  • filterCacheLowWaterMark Default is 1024.
  • filterCacheHighWaterMark Default is 2048.
  • 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.
  • mergeMaxThreadCount Must configure with mergeMaxMergeCount. The default is the number of tpc_cores as configured in cassandra.yaml.
  • mergeMaxMergeCount Must configure with mergeMaxThreadCount. The default calculated value is:
    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

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

Examples

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

Enable encryption on search index

Enable encryption on search index:
  1. Change the configuration schema:
    ALTER SEARCH INDEX CONFIG ON cycling.comments 
    SET directoryFactory = 'encrypted';
  2. Verify the change is correct in the pending schema:
    DESC PENDING SEARCH INDEX CONFIG ON cycling.comments
  3. Make the configuration active:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <config>
      <luceneMatchVersion>LUCENE_6_0_1</luceneMatchVersion>
      <dseTypeMappingVersion>2</dseTypeMappingVersion>
      <directoryFactory class="solr.EncryptedFSDirectoryFactory" name="DirectoryFactory"/>
      <indexConfig>
        <rt>false</rt>
      </indexConfig>
      <jmx/>
      <updateHandler>
        <autoSoftCommit>
          <maxTime>10000</maxTime>
        </autoSoftCommit>
      </updateHandler>
      <query>
        <filterCache class="solr.SolrFilterCache" highWaterMarkMB="2048" lowWaterMarkMB="1024"/>
        <enableLazyFieldLoading>true</enableLazyFieldLoading>
        <useColdSearcher>true</useColdSearcher>
        <maxWarmingSearchers>16</maxWarmingSearchers>
      </query>
      <requestDispatcher>
        <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000"/>
        <httpCaching never304="true"/>
      </requestDispatcher>
      <requestHandler class="solr.SearchHandler" default="true" name="search"/>
      <requestHandler class="com.datastax.bdp.search.solr.handler.component.CqlSearchHandler" name="solr_query"/>
      <requestHandler class="solr.UpdateRequestHandler" name="/update"/>
      <requestHandler class="solr.UpdateRequestHandler" name="/update/csv" startup="lazy"/>
      <requestHandler class="solr.UpdateRequestHandler" name="/update/json" startup="lazy"/>
      <requestHandler class="solr.FieldAnalysisRequestHandler" name="/analysis/field" startup="lazy"/>
      <requestHandler class="solr.DocumentAnalysisRequestHandler" name="/analysis/document" startup="lazy"/>
      <requestHandler class="solr.admin.AdminHandlers" name="/admin/"/>
      <requestHandler class="solr.PingRequestHandler" name="/admin/ping">
        <lst name="invariants">
          <str name="qt">search</str>
          <str name="q">solrpingquery</str>
        </lst>
        <lst name="defaults">
          <str name="echoParams">all</str>
        </lst>
      </requestHandler>
      <requestHandler class="solr.DumpRequestHandler" name="/debug/dump">
        <lst name="defaults">
          <str name="echoParams">explicit</str>
          <str name="echoHandler">true</str>
        </lst>
      </requestHandler>
    </config>
  4. Apply the configuration and rebuild the index:
    RELOAD SEARCH INDEX ON cycling.comments;

Auto soft commit max time

To set index configuration with shortcut for automatic soft commit max time to 10000ms:
ALTER SEARCH INDEX CONFIG ON cycling.comments 
SET autoCommitTime = 10000;
Make the pending changes active (use DESCRIBE SEARCH INDEX to review changes):
RELOAD SEARCH INDEX ON cycling.comments;

Request handler

Add a configuration request handler
ALTER SEARCH INDEX CONFIG ON cycling.comments 
ADD requestHandler[@name='/elevate',@class='solr.SearchHandler', @startup='lazy'] 
WITH  $$ {"defaults":[{"echoParams":"explicit"}],"last-components":["elevator"]} $$;
Reload the search index:
RELOAD SEARCH INDEX ON cycling.comments;
which adds the requestHandler element to the config:
<requestHandler name="/elevate" class="solr.SearchHandler"> 
   <lst name="defaults">
      <str name="echoParams">explicit</int>
   </lst>
   <arr name="last-components">
    <str>elevator</str>
   </arr>
</requestHandler>
To extend TieredMergePolicy to support automatic removal of deletes:
ALTER SEARCH INDEX CONFIG ON cycling.comments 
SET indexConfig.mergePolicyFactory[@class='org.apache.solr.index.AutoExpungeDeletesTieredMergePolicyFactory'].bool[@name='mergeSingleSegments'] = true;

ALTER SEARCH INDEX CONFIG ON cycling.comments 
SET indexConfig.mergePolicyFactory[@class='org.apache.solr.index.AutoExpungeDeletesTieredMergePolicyFactory'].int[@name='maxMergedSegmentMB'] = 1005;

ALTER SEARCH INDEX CONFIG ON cycling.comments 
SET indexConfig.mergePolicyFactory[@class='org.apache.solr.index.AutoExpungeDeletesTieredMergePolicyFactory'].int[@name='forceMergeDeletesPctAllowed'] = 25;
Reload the search index:
RELOAD SEARCH INDEX ON cycling.comments;

Change the auto-commit time

To change the automatic commit time, ALTER SEARCH INDEX CONFIG. For example:
ALTER SEARCH INDEX CONFIG ON cycling.comments 
SET autoCommitTime = 1000;