Updated on 2022-09-21 GMT+08:00

MySQL->CSS/ES

Table 1 Data type mapping

Data Type (MySQL)

Data Type (Elasticsearch)

Whether to Support Mapping

BIT[(M)]

BOOLEAN | LONG|TEXT

Yes

BOOLEAN: 1 byte

LONG: 2 to 63 bytes

TEXT: 64 bytes

TINYINT[(M)]

SHORT

Yes

TINYINT[(M)] [UNSIGNED]

INTEGER

Yes

SMALLINT[(M)]

SHORT

Yes

SMALLINT[(M)] [UNSIGNED]

INTEGER

Yes

MEDIUMINT[(M)]

INTEGER

Yes

MEDIUMINT[(M)][UNSIGNED]

INTEGER

Yes

INT[(M)]

INTEGER

Yes

INT[(M)] [UNSIGNED]

LONG

Yes

BIGINT[(M)]

LONG

Yes

BIGINT[(M)] [UNSIGNED]

TEXT

Yes

DECIMAL[(M[,D])]

SHORT| INTEGER| LONG| TEXT| DOUBLE

Yes. Use a data type that meets the precision and scale requirements.

FLOAT(p)

FLOAT

Yes

DOUBLE[(M,D)]

DOUBLE

Yes

DATE

DATETIME

Yes; format: yyyy-mm-dd

DATETIME[(fsp)]

DATETIME

Yes; format: yyyy-mm-dd't'hh:mm:ss

TIMESTAMP[(fsp)]

DATETIME

Yes; format: yyyy-mm-dd't'hh:mm:ss

TIME[(fsp)]

DATETIME

Yes; format: hh:mm:ss

YEAR[(4)]

DATETIME

Yes; format: yyyy

CHAR[(M)]

TEXT

Yes

VARCHAR(M)

TEXT

Yes

BINARY[(M)]

BINARY

Yes

VARBINARY(M)

BINARY

Yes

TINYBLOB

BINARY

Yes

TINYTEXT

TEXT

Yes

BLOB

BINARY

Yes

TEXT

TEXT

Yes

MEDIUMBLOB

BINARY

Yes

MEDIUMTEXT

TEXT

Yes

LONGBLOB

BINARY

Yes

LONGTEXT

TEXT

Yes

ENUM('value1','value2',...)

KEYWORD

Yes

SET('value1','value2',...)

KEYWORD

Yes

GEOMETRY

GEO_SHAPE

Yes

POINT

GEO_SHAPE

Yes

LINESTRING

GEO_SHAPE

Yes

POLYGON

GEO_SHAPE

Yes

MULTIPOINT

GEO_SHAPE

Yes

MULTILINESTRING

GEO_SHAPE

Yes

MULTIPOLYGON

GEO_SHAPE

Yes

GEOMETRYCOLLECTION/GEOMCOLLECTION

GEO_SHAPE

Yes

JSON

OBJECT

Yes