Dropping columns from the index

Remove a CQL column from the index.

Remove a CQL column using the ALTER SEARCH INDEX SCHEMA field shortcut. The field is removed based on the name that is defined in the schema.

Procedure

  1. Remove a CQL column from the index:
    • Remove a regular column:
      ALTER SEARCH INDEX SCHEMA ON wiki.solr
      DROP field intfield;
      
      ALTER TABLE wiki.solr
      DROP intfield int;
    • Remove a field that contains special characters, like an asterisk, by placing the field name in quotes. This example shows the short form command, which places the field name inside double quotes:
      ALTER SEARCH INDEX SCHEMA ON wiki.solr
      DROP field "fieldname*";
      This example shows the long form command, which places the field name inside single quotes:
      ALTER SEARCH INDEX SCHEMA ON wiki.solr
      DROP fields.field[@name='fieldname*'];
    • Remove a dynamic field, which uses the long form command because the field contains an asterisk:
      ALTER SEARCH INDEX SCHEMA ON wiki.solr
      DROP fields.dynamicField[@name='dyna_*'];
    • Remove a copy field, which uses the long form command because the source and destination fields must be specified:
      ALTER SEARCH INDEX SCHEMA ON wiki.solr
      DROP copyField[@source='name', @dest='allfields'];
    • Remove a tuple column from the index.
      When dropping the base field name, drop the TupleField and all the child fields:
      ALTER SEARCH INDEX SCHEMA ON wiki.solr
      DROP field fieldname;
      To drop individual child fields:
      ALTER SEARCH INDEX SCHEMA ON wiki.solr
      DROP field "fieldname.field1";
  2. Verify the pending changes:
    DESCRIBE PENDING SEARCH INDEX SCHEMA ON [keyspace_name.]table_name;
  3. Activate the changes:
    RELOAD SEARCH INDEX ON [keyspace_name.]table_name;
    Copies the pending schema over the active schema. New transactions, such as data inserted into the table, are processed using the active schema. The existing data is not effected by a schema change.
  4. Rebuild the index:
    REBUILD SEARCH INDEX ON [keyspace_name.]table_name;
    The REBUILD SEARCH INDEX regenerates the index using existing data. Rebuilding is required when changing the way that data is indexed, such as changing the type of field or if a field is added to the index.