Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Labs

Define Mappings in Elasticsearch

Dynamic templates in Elasticsearch make it very easy to index data without having to create explicit mappings for every field. However, sometimes you might prefer to create explicit mappings, or even disable dynamic mapping altogether, in order to have a tighter control over your index structure and datatype requirements. In this learning activity, you are given the opportunity to create explicit field mappings for an index containing log data. Specifically, you will exercise how to: * Create analyzed string fields with a specific analyzer * Create non-analyzed string fields with character limits * Create `geo_point` field mappings * Create numerical field mappings * Create date field mappings * Create IP field mappings * Create nest field mappings (objects) * Reindex data from one index into another with different mappings

Lab platform
Lab Info
Level
Advanced
Last updated
Sep 18, 2025
Duration
2h 0m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Create the index with explicit field mappings.

    Use the Kibana console tool to execute the following:

    PUT logs_new
    {
      "mappings": {
        "properties": {
          "@message": {
            "type": "text"
          },
          "@tags": {
            "type": "keyword",
            "ignore_above": 128
          },
          "@timestamp": {
            "type": "date"
          },
          "@version": {
            "type": "keyword",
            "ignore_above": 256
          },
          "agent": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "bytes": {
            "type": "long"
          },
          "clientip": {
            "type": "ip"
          },
          "extension": {
            "type": "keyword",
            "ignore_above": 256
          },
          "geo": {
            "properties": {
              "coordinates": {
                "type": "geo_point"
              },
              "dest": {
                "type": "keyword",
                "ignore_above": 128
              },
              "src": {
                "type": "keyword",
                "ignore_above": 128
              },
              "srcdest": {
                "type": "keyword",
                "ignore_above": 128
              }
            }
          },
          "headings": {
            "type": "keyword",
            "ignore_above": 256
          },
          "host": {
            "type": "keyword",
            "ignore_above": 256
          },
          "ip": {
            "type": "ip"
          },
          "links": {
            "type": "keyword",
            "ignore_above": 256
          },
          "machine": {
            "properties": {
              "os": {
                "type": "keyword",
                "ignore_above": 256
              },
              "ram": {
                "type": "long"
              }
            }
          },
          "memory": {
            "type": "long"
          },
          "phpmemory": {
            "type": "long"
          },
          "referrer": {
            "type": "keyword",
            "ignore_above": 256
          },
          "relatedContent": {
            "properties": {
              "article:modified_time": {
                "type": "date"
              },
              "article:published_time": {
                "type": "date"
              },
              "article:section": {
                "type": "keyword",
                "ignore_above": 128
              },
              "article:tag": {
                "type": "keyword",
                "ignore_above": 128
              },
              "og:description": {
                "type": "text"
              },
              "og:image": {
                "type": "keyword",
                "ignore_above": 256
              },
              "og:image:height": {
                "type": "long"
              },
              "og:image:width": {
                "type": "long"
              },
              "og:site_name": {
                "type": "keyword",
                "ignore_above": 256
              },
              "og:title": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              "og:type": {
                "type": "keyword",
                "ignore_above": 128
              },
              "og:url": {
                "type": "text",
                "analyzer": "simple",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              "twitter:card": {
                "type": "keyword",
                "ignore_above": 128
              },
              "twitter:description": {
                "type": "text"
              },
              "twitter:image": {
                "type": "keyword",
                "ignore_above": 256
              },
              "twitter:site": {
                "type": "keyword",
                "ignore_above": 128
              },
              "twitter:title": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 128
                  }
                }
              },
              "url": {
                "type": "text",
                "analyzer": "simple",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          },
          "request": {
            "type": "text",
            "analyzer": "simple",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "response": {
            "type": "keyword",
            "ignore_above": 128
          },
          "spaces": {
            "type": "text",
            "analyzer": "whitespace"
          },
          "url": {
            "type": "text",
            "analyzer": "simple",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "utc_time": {
            "type": "date"
          },
          "xss": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 512
              }
            }
          }
        }
      },
      "settings": {
        "number_of_shards": 4,
        "number_of_replicas": 3
      }
    }
    
  2. Challenge

    Reindex the documents from the logs index into the logs_new index.

    Use the Kibana console tool to execute the following:

    POST _reindex
    {
      "source": {
        "index": "logs"
      },
      "dest": {
        "index": "logs_new"
      }
    }
    
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight