This topic describes how to use OceanBase Migration Service (OMS) to migrate data from Elasticsearch to OceanBase Database in MySQL-compatible mode (including physical data sources, public cloud data sources, and standalone data sources).
Background information
Elasticsearch is a distributed search and analytics engine. Data is organized into indices, which can be analogized to tables in a relational database. OMS supports migrating index data and structures from Elasticsearch to the MySQL-compatible mode of OceanBase Database.
In the OMS console, the data source type for Elasticsearch is displayed as ElasticSearch, and this link only supports the object type Tables. The migration types currently supported by this link are shown in the following table.
Migration Type |
Supported Scenarios |
|---|---|
| Schema Migration | Supported |
| Full Migration | Supported |
| Incremental Synchronization | Supported |
| Incremental DDL | Not supported |
| Reverse Incremental | Supported |
Limitations
Limitations on the source database
Do not perform DDL operations that modify the index structure during schema migration or full migration. Otherwise, the data migration task may be interrupted.
This link does not support incremental DDL. Mapping changes (adding fields or modifying field types) occurring in the source Elasticsearch will not be synchronized to the target, potentially leading to data inconsistency between the source and target.
OMS does not support triggers on the target side. If triggers exist, data migration may fail.
Data source identifiers and user accounts must be globally unique within the OMS system.
OMS only supports migrating objects whose database, table, and column names are in ASCII and do not contain special characters (including line breaks, spaces, and
.|"'`()=;/&\).Indices with names containing dots (.) are also not supported, for example,
api7-ai-logs-2026.07.29. If such objects exist at the source, use the Specify Objects method to individually select the objects you want to migrate. Do not use the Match by Rule method to select objects, as the matching rules will match these objects and cause migration errors.Currently supported Elasticsearch versions are V7.x (V7.6.0 and later), V8.x, and V9.x.
It is recommended that you do not migrate more than 1,000 indices at a time to avoid affecting the operation of the data migration task.
This link supports the DML types
Insert,Update, andDeletefor Incremental Synchronization, but the actual DML that can be captured depends on the incremental method:Translog plugin: Can capture
Insert,Update, andDelete. This method requires installing the OMS incremental plugin on the Elasticsearch cluster. Installing the plugin requires restarting an Elasticsearch node (rolling restarts can be used). The plugin version must match the full version number of the Elasticsearch server, and the plugin must be installed and restarted on every node in the cluster. Checking only the nodes corresponding to connection addresses is not sufficient to ensure stable task operation; migration may still be interrupted after primary shards move to other nodes. You can executeGET /_nodes/pluginsto confirm installation on each node. For details, see the section below titled "Install the Translog incremental plugin"._seq_nopagination query: No plugin installation is required, butDeleteoperations cannot be captured, and deleted data will remain in the target. If you have selectedDeletein the migration options, please choose the Translog plugin method.
Migrating indices containing the following field types is not supported:
percolator,completion,annotated-text,join(parent-child association),sparse_vector,date_nanos, andflattened. When any of these field types exist, the precheck will block the task and indicate the reason.This link only supports default routing. If the source index has
_routing.required=trueset, the precheck will intercept the task. Documents using custom routing cannot complete full migration normally.Multi-valued fields (where a document's value for the same field can be an array) must be explicitly configured for migration as JSON type; otherwise, the task will be blocked. If the source field's mapping is a scalar type like
keywordbut the documents actually store arrays, simply changing the target column toJSONis insufficient for full migration. You must first change the field to a single value at the source, or transform it into a supportedobject/nestedJSON container before migrating.The indices to be migrated must retain
_source. OMS relies on the complete_sourceto read index mappings, settings, and document data. If_sourceis disabled for the source index, the precheck will block the task and indicate the reason.
Considerations
This link does not support partition-related migration capabilities. Do not create partitioned tables at the target before migration.
If the document field type at the source does not match the column type at the target, or if the data exceeds the length and precision range of the target column, the data migration task may fail.
Schema migration generates the target table structure based on the index mapping snapshot obtained when the task is created. Elasticsearch supports dynamic fields, while the target table structure is fixed. Fields newly added at the source will not be automatically synchronized to the target.
When the data types of fields with the same name are inconsistent across different documents within the same index (which is allowed in Elasticsearch but not in OceanBase Database), OMS creates a table based on the data type of the first encountered document. During write operations, records with mismatching data types will be logged as conflicts and the conflicting field will be skipped.
For fields with multiple fields (
fields) configured, OMS migrates only the primary field. Sub-fields such ascity.keywordwill not have separate columns created.Index aliases and index templates are not migrated. The actual index that the alias points to needs to be migrated separately.
The
_es_idcolumn in the target table is used to store the source document ID and serves as the unique key for incremental synchronization and reverse incremental data location. Do not modify or delete this column at the target side; otherwise,UPDATEandDELETEoperations will fail to match data.The
datetype already covers common ISO formats, explicit time zones, and task time zone formats. Any customformatis not yet fully supported. Thedate_nanosfield type is currently not supported for migration, and the precheck will block the task.geo_pointsupports the{lat,lon}and[lon,lat]formats and outputs them uniformly aslat,lonstrings. Currently, formats such as geohash and GeoJSON Point are not supported;geo_shapecurrently only supports Point, LineString, and Polygon.Vector indexes at the target side are not within the scope of schema migration. Please create them yourself after migration is complete.
Before performing a forward switchover, ensure that your business has stopped writing data to the index to be migrated. Stopping writes must be done manually. You can stop writing from the business application side, or disable writing through Elasticsearch's index write block (for example, by setting
index.blocks.writetotrue). OMS does not automatically stop writing at the source. For details, see the official Elasticsearch documentation Index blocks.This link does not support configuring row filters or selecting columns for migration objects; it only supports renaming and removing.
Prerequisites
The corresponding Schema has been created in the MySQL-compatible mode of the target OceanBase Database.
A dedicated database user for the data migration task has been created in both the source Elasticsearch cluster and the MySQL-compatible mode of the target OceanBase Database, and the relevant permissions have been granted. For details, see the "Permissions required when Elasticsearch is the source" and "Permissions required when Elasticsearch is the target" sections in Create a database user and User permissions.
An Elasticsearch data source and an OceanBase Database MySQL-compatible mode data source have been created in OMS. For details, see Create an Elasticsearch data source and Create an OceanBase physical data source.
If the Translog plugin method is selected for incremental synchronization, confirm that the OMS incremental plugin has been installed on every node of the Elasticsearch cluster and a rolling restart has been completed, and that the plugin version matches the full version number of the server. You can execute
GET /_nodes/pluginsto check the installation status node by node. The pagination query method using_seq_nodoes not require installing this plugin. For installation steps, see the section below titled "Install the Translog incremental plugin".
Install the Translog incremental plugin
When the Translog plugin method is selected as the incremental synchronization method, you need to install the OMS incremental plugin on every node of the source Elasticsearch cluster and perform a rolling restart. The plugin installation package is provided with OMS deployment and is located in the /home/ds/plugins/elasticsearch/ directory of the OMS container. Please select the corresponding ZIP file based on the full version number of the source Elasticsearch.
Query the full version number of Elasticsearch on each node of the source cluster. For example, execute
GET /_nodesand check theversionfield of each node.Locate the OMS container on the host where OMS resides and check the plugin version provided with the package.
docker ps docker exec <OMS Container Name> ls /home/ds/plugins/elasticsearch/Export the plugin package that matches the source version from the OMS container. Taking a source version of Elasticsearch 7.6.2 as an example:
docker cp <OMS Container Name>:/home/ds/plugins/elasticsearch/oms-es-ccr-plugin-7x-7.6.2.zip .Distribute the plugin package to each Elasticsearch node in the cluster and execute the installation command in the Elasticsearch installation directory of that node.
bin/elasticsearch-plugin install file:///tmp/oms-es-ccr-plugin-7x-7.6.2.zipIf Elasticsearch is also deployed in containers, ensure this path is visible within the Elasticsearch container.
Restart Elasticsearch node by node following the rolling restart process for the cluster. Once a node rejoins the cluster and the cluster status recovers, proceed to the next node.
Execute
GET /_nodes/pluginsto verify that all nodes have loaded the corresponding plugins.
Note
If there is no plugin package in the /home/ds/plugins/elasticsearch/ directory that exactly matches the source version, contact OceanBase Technical Support to confirm the correct installation package.
Data type mappings
Schema migration reads the index's mapping and settings, and generates the corresponding table structure at the target. The following table shows the mapping between Elasticsearch field types and column types in OceanBase Database's MySQL-compatible mode.
Elasticsearch field types |
Column types in the MySQL-compatible mode of OceanBase Database |
Description |
|---|---|---|
keyword |
LONGTEXT |
Exact match fields.ignore_aboveLimits only the index length and does not truncate it._sourceThe actual value in the field is therefore mapped toLONGTEXTto avoid write failures. |
wildcard |
LONGTEXT |
Fuzzy match fields,_sourceThe value in the field is a normal string. |
text |
LONGTEXT |
Full-text search fields, whose actual values can be quite long. |
match_only_text |
LONGTEXT |
textA lightweight variant of , billed by_sourceMigrate the original values. |
long |
BIGINT |
64-bit integer. |
unsigned_long |
BIGINT UNSIGNED |
64-bit unsigned integer. |
integer |
INT |
A 32-bit integer. |
short |
SMALLINT |
16-bit integer. |
byte |
TINYINT |
An 8-bit integer. |
double |
DOUBLE |
Double-precision floating-point number. |
float |
DOUBLE |
Elasticsearch'sfloatThe index column is of type float32. During migration, it is converted to_sourceDouble-precision values are retained to avoid precision loss. |
half_float |
DOUBLE |
Half-precision floating-point. |
scaled_float |
DOUBLE |
Scale floating-point numbers. |
date |
DATETIME(3) |
Retains millisecond precision. |
boolean |
TINYINT(1) |
trueWrite1,falseWrite0. |
binary |
LONGBLOB |
Base64-encoded binary data. The original byte length is unlimited. |
ip |
VARCHAR(45) |
Compatible with IPv6 addresses. |
object |
JSON |
JSON object. |
nested |
JSON |
The nested documents are written into the JSON column as a whole. |
geo_point |
VARCHAR(100) |
Converted tolat,lonA string in the specified format. |
geo_shape |
GEOMETRY |
The target OceanBase Database must be V4.x or later. |
dense_vector |
VECTOR(dims) |
The vector dimension is taken from the index mapping.dimsparameter.dimsWhen the parameter is missing or invalid, the task will be blocked. |
rank_feature |
DOUBLE |
Rank eigenvalues by_sourceThe original double-precision value is retained. |
histogram |
JSON |
Histogram data. |
alias |
Not migrate | The alias field contains no actual data. |
Note
Schema migration will additionally generate a
_es_id VARCHAR(512) COLLATE utf8mb4_bincolumn in the target table to store the source document ID, and create a unique index for it.Multi-valued fields must be explicitly configured as
JSONtype; otherwise, the target column type cannot be determined solely from the mapping.For fields with a mapping of
keywordor other scalar types, if a document actually stores an array, simply changing the target column toJSONis insufficient for full migration. First, change the field to a single value at the source, or modify it into a supportedobject/nestedJSON container before migrating.
When Reverse Increment is selected, OMS writes changes back from the target to the source Elasticsearch. The following table shows the correspondence between column types in OceanBase Database's MySQL-compatible mode and Elasticsearch field types.
Column types in the MySQL-compatible mode of OceanBase Database |
Elasticsearch field types |
|---|---|
VARCHAR / CHAR |
keyword |
LONGTEXT / TEXT |
text |
BIGINT / INT / SMALLINT / TINYINT |
long / integer |
FLOAT / DOUBLE |
float / double |
DATETIME / TIMESTAMP |
date |
TINYINT(1) |
boolean |
JSON |
object(Determined from the content) |
VARBINARY |
binary(Base64-encoded) |
Notice
Reverse increment only synchronizes DML, not DDL. Newly added fields at the target will be ignored when written back to Elasticsearch. Fields such as JSON, geospatial, and vector types are retained only as strings, which does not restore the query capabilities of their native Elasticsearch types.
Reverse increment only writes back to the original index bound to the migration task. OMS verifies the index UUID. If the original index has been deleted, it cannot be re-written even if rebuilt with the same name. Please retain the original index at the source during migration and reverse increment.
After switching services to OceanBase Database, if a column corresponding to
dense_vectoris inserted or updated toNULL, reverse increment will send an explicit JSONnullto the original index, triggering an HTTP 400mapper_parsing_exceptionand interrupting the reverse synchronization. Please check the application-side writable path for null values in this column before the switch, and provide valid vectors that match the original index dimensions for this column during reverse increment.
Procedure
Create a data migration task.
Log in to the OMS console.
In the left-side navigation pane, click Data Migration.
On the Data Migration page, click Create Task in the upper-right corner.
On the Create Task page, customize the name of the migration task.
We recommend that you use a combination of Chinese characters, numbers, and letters. The name must not contain spaces and cannot exceed 64 characters in length.
Notice
The task name is a unique identifier within the OMS system. Please choose an appropriate name.
In the Select Source and Target step, configure the parameters.
ParameterDescriptionSource If you have created an Elasticsearch data source, select it from the drop-down list. If not, click New Data Source in the drop-down list to create one in the dialog box on the right. For details, see Create an Elasticsearch data source. Target If you have created a physical data source in MySQL-compatible mode of OceanBase Database, select it from the drop-down list. If not, click New Data Source in the drop-down list to create one in the dialog box on the right. For details, see Create a physical data source in OceanBase Database. Tag Click the text box and select a target tag from the drop-down list. You can also click Manage Tags to create, modify, or delete tags. For more information, see Manage data migration tasks by using tags. Click Next. In the Select Migration Type step, select the migration type for the current data migration task.
The Migration Type includes Schema Migration, Full Migration, Incremental Synchronization, and Reverse Increment.
Migration typeLimitationsSchema migration After a schema migration task starts, OMS reads the mappings and settings of the source Elasticsearch index and creates corresponding table structures in the target database. For type mapping relationships, see "Data type mappings" in this topic. Full migration After a full migration task starts, OMS migrates the existing data of the source Elasticsearch index to the corresponding tables in the target database. Incremental synchronization After an incremental synchronization task starts, OMS synchronizes the changed data (inserts, modifications, or deletions) in the source Elasticsearch index to the corresponding tables in the target database.
The DML synchronization of Incremental Synchronization includesINSERT,DELETE, andUPDATE, which you can configure as needed. For details, see Configure DDL/DML synchronization. This link does not support incremental DDL.
Incremental data is obtained through the Translog plugin or_seq_nopagination queries. The_seq_nopagination query cannot captureDELETEoperations. For details, see "Limitations" in this topic.Reverse increment After a reverse increment task starts, it can continuously flow back the change data generated in the target database after the business switch to the source Elasticsearch in real time.
Typically, reverse increment reuses the configuration of incremental synchronization. You can also configure it according to actual needs. The following situations do not support selecting Reverse Increment:- Multiple-table aggregation exists.
- There are multiple Schema-to-one mappings.
Reverse increment only writes back to the original index bound to the migration task and verifies the index UUID. If the original index is deleted and then rebuilt with the same name, further writing cannot continue. Therefore, retain the source index during migration.Click Next. In the Select Migration Objects step, select the objects to be migrated for the current data migration task.
You can select migration objects through two options: Specify Objects and Match by Rule. This topic describes how to select objects by using Specify Objects. For details on configuring matching rules, see Configure matching rules for migration or synchronization objects.
In the Select Migration Objects step, select Specify Objects.
In the Source Object(s) list, select the objects to be migrated. You can select one or more indexes as migration objects.
Click > to add them to the Target Objects list.
OMS supports renaming target objects and removing single or all migration objects, but does not support setting row filter conditions or selecting columns.
Notice
If you rename migration objects or select objects using matching rules, confirm that each specific source index corresponds to a target table when previewing the mapping results. Different indexes may have the same document
_id. Even without selecting reverse incremental migration, mapping them to the same target table can result in data overwriting or accidental deletion. Do not rely on the precheck to detect all such conflicts.OperationStepRename OMS supports renaming migration objects. For more information, see Rename a database or table. Remove/Remove All OMS allows you to remove one or more temporarily selected objects during data mapping. - Remove a single migration object
In the Target Objects list, hover over the target object and click the displayed Remove to remove it. - Remove all migration objects
In the Target Objects list, click Remove All in the upper-right corner. In the dialog box, click OK to remove all migration objects.
Click Next. In the Migration Options step, configure the parameters.
Schema migration
The parameters in this section are displayed only if you have selected Schema Migration in the Select Migration Type step. You can set whether to automatically proceed to the next stage after schema migration is completed. This migration mode does not support index migration. OMS automatically creates indexes for the destination tables based on the unique
_es_idcolumn.Full migration
The parameters in this section are displayed only if you have selected Full Migration in the Select Migration Type step. You can configure the full migration rate limit, full migration resource configuration, and Processing Strategy When Target Table Has Records.
Incremental synchronization
The parameters in this section are displayed only if you have selected Incremental Synchronization in the Select Migration Type step. You can configure Incremental data capture method, incremental synchronization rate limit, incremental log pull resource configuration, incremental data write resource configuration, and incremental record retention time.
Notice
This mode does not support specifying an incremental synchronization start timestamp. By default, synchronization starts from the current time.
Reverse incremental
The parameters in this section are displayed only if you have selected Reverse Increment in the Select Migration Type step. The configuration parameters for reverse incremental are the same as those for incremental synchronization. You can select Reuse Incremental Synchronization Configuration in the upper-right corner.
If the page's configuration parameters do not meet your needs, you can click Parameter Configuration at the bottom of the page for more specific settings. If you have configured task templates or component templates, you can also reference them here.
Click Precheck to have the system perform a precheck on the data migration task.
During the Precheck phase, OMS checks whether the database's network connection meets requirements. The data migration task can only be started after all check items pass. If the precheck reports an error:
You can troubleshoot and resolve the issue, then re-execute the precheck until it succeeds.
You can also click Skip in the Actions column for the failed precheck item. A dialog box appears, explaining the specific impact of skipping the operation. After confirming it is acceptable to skip, click OK in the dialog box.
Click Start Task. If you do not need to start the task immediately, click Save to go to the data migration task details page, where you can start it manually as needed.
You can click Configure Validation Task in the upper-right corner of the data migration details page to compare data differences between the source Elasticsearch cluster and the target database. For more information, see Create a data verification task.
OMS supports modifying migration objects during the execution of a data migration task. For more information, see View and modify migration objects. After a data migration task is started, it is executed sequentially according to the selected migration type. For more information, see the "View migration details" section in View the details of a data migration task.