Although SQL and Elasticsearch have different terms for the way the data is organized (and different semantics), these analogies can help those with a relational database background understand Elasticsearch. However, it’s important to recognize that these analogies are not perfect, as there are fundamental differences in how each system stores and manages data.

Terminologies and data types

SQL Elasticsearch Description
database index In Elasticsearch, an index is a collection of documents and serves a role similar to a database in SQL.
table index In Elasticsearch, an index also serves a role similar to a table in SQL, as it stores documents (akin to rows) with fields (akin to columns).
row document A document in Elasticsearch is a JSON object and is similar to a row in an SQL table.
column field A field in Elasticsearch corresponds to a column in an SQL table and contains data for a specific attribute of a document.
INSERT POST In MySQL, you insert rows into a table using SQL. In Elasticsearch, you index documents using RESTful APIs, with POST (when ID is auto-generated) or PUT (when specifying an ID).
SELECT GET In SQL, SELECT is used to retrieve rows from a table. In Elasticsearch, GET is used to retrieve documents from an index.
AND must In Elasticsearch Query DSL, the ‘must’ clause functions like the logical AND in SQL.
OR should In Elasticsearch Query DSL, the ‘should’ clause functions like the logical OR in SQL.
NOT must_not In Elasticsearch Query DSL, the ‘must_not’ clause functions like the logical NOT in SQL.
TINYINT byte In Elasticsearch, ‘byte’ is an 8-bit signed integer.
SMALLINT short In Elasticsearch, ‘short’ is a 16-bit signed integer.
BIGINT long In Elasticsearch, ‘long’ is a 64-bit signed integer.
REAL float In Elasticsearch, ‘float’ is a 32-bit single-precision floating point.
FLOAT half_float In Elasticsearch, ‘half_float’ is a 16-bit half-precision floating point.
DOUBLE scaled_float In Elasticsearch, ‘scaled_float’ is a floating-point number that is backed by a long and can be scaled by a fixed double factor.
VARCHAR keyword In Elasticsearch, ‘keyword’ is used for structured content such as IDs, email addresses, hostnames, status codes, zip codes, etc. Keyword fields are not analyzed for full-text search.
VARCHAR text In Elasticsearch, ‘text’ is used for full-text content such as the body of an email or a product description. ‘Text’ fields are analyzed for full-text search.
VARCHAR ip In Elasticsearch, the ‘ip’ field can index and store either IPv4 or IPv6 addresses.
VARCHAR version In Elasticsearch, ‘version’ is a specialization of the ‘keyword’ field for handling software version strings.
TIMESTAMP date In Elasticsearch, ‘date’ fields can index strings containing formatted dates, or numbers representing milliseconds-since-the-epoch or seconds-since-the-epoch.
STRUCT object In Elasticsearch, ‘object’ fields can hold JSON objects, allowing for nested, complex data structures.
STRUCT nested In Elasticsearch, ‘nested’ fields are a specialized version of ‘object’ fields that allow arrays of objects to be indexed and queried as independent documents.