Nidhi Gupta
3 min readSep 20, 2021

--

Mappings in Elasticsearch

In this article, we will see how mappings are used in Elasticsearch and its pros and cons.

Mapping is the process that defines how a document, which contains fields is stored and indexed in Elasticsearch. It defines the schema of the document and datatype for fields in the document.

Syntax to check index mappings: GET /index_name/_mappings

There are two types of mappings used in Elasticsearch

Explicit mapping

Dynamic mapping

Explicit mapping

This type of mapping allows us to choose how to define the mapping definition, such as provide an option to name our columns their data types, whether string value should be treated as keyword or full-text fields, numeric value to integer or long, format of date values and many more.

Dynamic mapping

This type of mapping dynamically maps fields based on their value. Just by indexing a document, fields get mapped and also we can add a new column to our index. Based on the document field value Elasticsearch dynamically detects its data type.

Now let’s move to the implementation of mapping

Problem statement: Make use of explicit and dynamic mapping to create an index called employee having fields first_name and…

--

--

Nidhi Gupta

Azure Data Engineer 👨‍💻.Heading towards cloud technologies expertise✌️.