Elastic MySQL connector referenceedit

The Elastic MySQL connector is a connector for MySQL data sources.

Availability and prerequisitesedit

This connector is available as a native connector in Elastic versions 8.5.0 and later. To use this connector as a native connector, satisfy all native connector requirements.

This connector is also available as a connector client from the Python connectors framework. To use this connector as a connector client, satisfy all connector client requirements.

This connector has no additional prerequisites beyond the shared requirements, linked above.

This connector is available in technical preview. Features in technical preview are subject to change and are not covered by the service level agreement (SLA) of features that have reached general availability (GA).

Usageedit

To use this connector as a native connector, use the use a connector workflow. See Native connectors.

To use this connector as a connector client, use the build a connector workflow. See Connector clients and frameworks.

For additional operations, see Usage.

Known issuesedit

There are no known issues with this connector.

See Known issues for any issues affecting all connectors.

Troubleshootingedit

See Troubleshooting.

Securityedit

See Security.

Compatibilityedit

This connector is compatible with MySQL 5.6 and later.

The connector is also compatible with MariaDB databases compatible with the above.

The data source and your Elastic deployment must be able to communicate with each other over a network.

Configurationedit

Each time you create an index to be managed by this connector, you will create a new connector configuration. You will need some or all of the following information about the data source.

Host

The IP address or domain name of the MySQL host, excluding port. Examples:

  • 192.158.1.38
  • localhost
Port

The port of the MySQL host. Examples:

  • 3306
  • 3307
Username

The MySQL username the connector will use.

The user must have access to the configured databases. You may want to create a dedicated, read-only user for each connector.

Password
The MySQL password the connector will use.
Databases

The MySQL databases to sync. One or more database names, separated by commas. Each database must be accessible using the configured username and password.

Examples:

  • products,categories
  • orders

Documents and syncsedit

The following describes the default syncing behavior for this connector. Use sync rules and ingest pipelines to customize syncing for specific indices.

All records in the MySQL databases included in your connector configuration are extracted and transformed into documents in your Elasticsearch index.

  • For each row in your MySQL database table, the connector creates one Elasticsearch document.
  • For each column, the connector transforms the column into an Elasticsearch field.
  • Elasticsearch dynamically maps MySQL data types to Elasticsearch data types.
  • Field values that represent other records are replaced with the primary key for that record (composite primary keys are joined with _).

The Elasticsearch mapping is created when the first document is created.

Each sync is a "full" sync.

For each MySQL row discovered:

  • If it does not exist, the document is created in Elasticsearch.
  • If it already exists in Elasticsearch, the Elasticsearch document is replaced and the version is incremented.
  • If an existing Elasticsearch document no longer exists in the MySQL table, it is deleted from Elasticsearch.

Framework and sourceedit

This connector is included in the Python connectors framework.

View the source code for this connector (branch 8.6, compatible with Elastic 8.6).