• Downloads
  • Services
  • Resources

    • Documentation
    • Cheatsheets
    • Courses
    • Free Config Review
    • Blog
    • Forum
  • About

    • Manticore Search
    • Clients
  • Contact
  • ☝ Introduction
  • ❗ Read this first
  • ✔ ️Installation
    • Docker
    • RedHat and Centos
    • Debian and Ubuntu
    • MacOS
    • Windows
    • Compiling from sources
    • Migration from Sphinx
  • ⚡ Quick start guide
  • ✔ ️Starting the server
    • In Linux
    • Manually
    • In Docker
    • In Windows
    • In MacOS
  • ▪️ Creating an index
    • Data types
    • Creating a local index
      • ✔ ️Real-time index
      • Plain index
      • Plain and real-time index settings
      • Percolate index
      • Template index
    • NLP and tokenization
      • Data tokenization
      • Supported languages
      • CJK
      • Low-level tokenization
      • Wildcard searching settings
      • Ignoring stop words
      • Word forms
      • Exceptions
      • Morphology
      • Advanced HTML tokenization
    • Creating a distributed index
      • Creating a local distributed index
      • Remote indexes
  • ▪️ Listing indexes
  • ▪️ Deleting an index
  • ▪️ Emptying an index
  • ▪️ Creating a cluster
    • Adding a new node
    • Remote nodes
      • Mirroring
      • Load balancing
    • Setting up replication
      • Creating a replication cluster
      • Joining a replication cluster
      • Deleting a replication cluster
      • Adding and removing an index from a replication cluster
      • Managing replication nodes
      • Replication cluster status
      • Restarting a cluster
      • Cluster recovery
  • ✔️Connecting to the server
    • MySQL protocol
    • HTTP
  • ▪️ Adding documents to an index
    • ✔ ️Adding documents to a real-time index
    • Adding rules to a percolate index
  • ▪️ Adding data from external storages
    • Plain indexes creation
    • Fetching from databases
      • Introduction
      • Database connection
      • Execution of fetch queries
      • Indexing fetched data
      • Ranged queries
    • Fetching from XML stream
    • Fetching from CSV,TSV
    • Main+delta schema
    • Adding data from indexes
      • Merging indexes
      • Killlists in plain indexes
      • Attaching a plain index to RT index
      • Importing RT index
    • Rotating an index
  • ✔ ️Updating documents
    • REPLACE vs UPDATE
    • REPLACE
    • UPDATE
  • ▪️ Deleting documents
  • ▪️ Transactions
  • ✔ ️Searching
    • Full-text matching
      • Basic usage
      • Operators
      • Escaping
      • Search profiling
      • Boolean optimization
    • Search results
    • Filters
    • Expressions
    • Search options
    • Highlighting
    • Sorting and ranking
    • Distributed searching
    • Multi-queries
    • Sub-selects
    • Grouping
    • Faceted search
    • Geo search
    • Percolate query
    • Autocomplete
    • Spell correction
    • Query cache
    • Collations
  • ▪️ Updating index schema
  • ▪️ Functions
    • Mathematical functions
    • Searching and ranking functions
    • Type casting functions
    • Functions to handle arrays and conditions
    • Date and time functions
    • Geo-spatial functions
    • String functions
    • Other functions
  • ▪️ Securing and compacting an index
    • Few words about RT index structure
    • Flushing RAM chunk to a new disk chunk
    • Flushing RT index to disk
    • Compacting an index
    • Flushing attributes
    • Flushing hostnames
  • ▪️ Security
    • SSL
  • ▪️ Logging
    • Query logging
    • Server logging
    • Binary logging
    • Docker logging
    • Rotating query and server logs
  • ▪️ Profiling and monitoring
    • Node status
    • SHOW META
    • SHOW THREADS
    • SHOW WARNINGS
    • SHOW VARIABLES
    • SHOW COLLATION
    • Profiling
      • Query profiling
      • Query plan
    • Index settings and status
      • SHOW INDEX STATUS
      • SHOW INDEX SETTINGS
  • ▪️ Server settings
    • Searchd
    • Common
    • Special suffixes
    • Scripted configuration
    • Setting variables online
  • ▪️ Extensions
    • SphinxSE
    • FEDERATED
    • UDFs and Plugins
      • Listing plugins
      • UDF
        • Creating a function
        • Deleting a function
      • Plugins
        • Creating a plugin
        • Deleting a plugin
        • Reloading plugins
        • Ranker plugins
        • Token filter plugins
  • ▪️ Miscellaneous tools
  • ▪️ Changelog
  • 🐞 Reporting bugs
  • 📖 References

Updating index schema

Updating index schema in RT mode

ALTER TABLE index {ADD|DROP} COLUMN column_name [{INTEGER|INT|BIGINT|FLOAT|BOOL|MULTI|MULTI64|JSON|STRING|TIMESTAMP}]

It supports adding one attribute at a time for both plain and RT indexes. The int, bigint, float, bool, multi-valued, multi-valued 64bit, json and string attribute types are supported. You can add json and string attributes, but you cannot modify their values.

Important notes:

  • Querying an index is impossible (because of a write lock) while adding a column.
  • Newly created attribute's values are set to 0.
  • ALTER will not work for distributed indexes and indexes without any attributes.
  • DROP COLUMN will fail if an index has only one attribute.

Updating index schema in plain mode

ALTER RTINDEX index RECONFIGURE

ALTER can also reconfigure an RT index in plain mode, so that new tokenization, morphology, and other text processing settings from the configuration file take effect on the newly INSERT-ed rows, while retaining the existing rows as they were. Internally, it forcibly saves the current RAM chunk as a new disk chunk, and adjusts the index header, so that the new rows are tokenized using the new rules.

‹›
  • Example
Example
📋
⚙
mysql> desc plain;
+------------+-----------+
| Field      | Type      |
+------------+-----------+
| id         | bigint    |
| text       | field     |
| group_id   | uint      |
| date_added | timestamp |
+------------+-----------+
4 rows in set (0.01 sec)

mysql> alter table plain add column test integer;
Query OK, 0 rows affected (0.04 sec)

mysql> desc plain;
+------------+-----------+
| Field      | Type      |
+------------+-----------+
| id         | bigint    |
| text       | field     |
| group_id   | uint      |
| date_added | timestamp |
| test       | uint      |
+------------+-----------+
5 rows in set (0.00 sec)

mysql> alter table plain drop column group_id;
Query OK, 0 rows affected (0.01 sec)

mysql> desc plain;
+------------+-----------+
| Field      | Type      |
+------------+-----------+
| id         | bigint    |
| text       | field     |
| date_added | timestamp |
| test       | uint      |
+------------+-----------+
4 rows in set (0.00 sec)
️ Functions

Functions

️ Updating index schema Mathematical functions