Define Elasticsearch Indices and Aliases

1.5 hours
  • 7 Learning Objectives

About this Hands-on Lab

In Elasticsearch, the data we index is stored in an **index**. The word _index_ here is used as both a verb and a noun. Essentially, we perform an index operation in order to store data in an index. Before we can do this, however, we first need to understand the structure of an index and how to define one to meet specific requirements. In this hands-on lab, you will define Elasticsearch indexes by completing the following tasks:

* Configure the number of primary shards of an index
* Configure the number of replica shards of an index
* Allocate the shards for an index to **hot** nodes
* Allocate the shards for an index to **warm** nodes
* Associate indexes with aliases

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create the logs-2020-01-05 index.

Use the Kibana console tool to execute the following:

PUT logs-2020-01-05
{
  "aliases": {
    "logs": {},
    "this_week": {}
  }, 
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1,
    "index.routing.allocation.require.temp": "warm"
  }
}
Create the logs-2020-01-06 index.

Use the Kibana console tool to execute the following:

PUT logs-2020-01-06
{
  "aliases": {
    "logs": {},
    "this_week": {}
  }, 
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1,
    "index.routing.allocation.require.temp": "warm"
  }
}
Create the logs-2020-01-07 index.

Use the Kibana console tool to execute the following:

PUT logs-2020-01-07
{
  "aliases": {
    "logs": {},
    "this_week": {}
  }, 
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1,
    "index.routing.allocation.require.temp": "warm"
  }
}
Create the logs-2020-01-08 index.

Use the Kibana console tool to execute the following:

PUT logs-2020-01-08
{
  "aliases": {
    "logs": {},
    "this_week": {}
  }, 
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1,
    "index.routing.allocation.require.temp": "warm"
  }
}
Create the logs-2020-01-09 index.

Use the Kibana console tool to execute the following:

PUT logs-2020-01-09
{
  "aliases": {
    "logs": {},
    "this_week": {}
  }, 
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1,
    "index.routing.allocation.require.temp": "warm"
  }
}
Create the logs-2020-01-10 index.

Use the Kibana console tool to execute the following:

PUT logs-2020-01-10
{
  "aliases": {
    "logs": {},
    "this_week": {},
    "yesterday": {}
  }, 
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1,
    "index.routing.allocation.require.temp": "hot"
  }
}
Create the logs-2020-01-11 index.

Use the Kibana console tool to execute the following:

PUT logs-2020-01-11
{
  "aliases": {
    "logs": {},
    "this_week": {},
    "today": {}
  }, 
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1,
    "index.routing.allocation.require.temp": "hot"
  }
}

Additional Resources

You work as a system administrator for a company that wants to use Elasticsearch with Kibana to store and analyze some log data. You are being asked to prepare the Elasticsearch cluster for the log data by creating some indexes. Logs are considered time-series data, and we typically care most about the most recent logs. We need to make sure the data we care most about is allocated to our fastest, or "hot," nodes. The data we care less about can be allocated to slower "warm" nodes, which won't be indexed or searched as often. We also need to be able to search the data using aliases such as "this_week", "yesterday", or "today". Aliases make it easy to search the data you care about because you don't have to know specific index names.

You have a pre-configured, 6-node Elasticsearch cluster with Kibana already set up and running on the coordinator-1 node. You will need to use Kibana's console tool to interact with Elasticsearch's APIs to create the following indexes:

-----------------+-----------+-----------+----------+------------
 Name            | Aliases   | Primaries | Replicas | Allocation 
-----------------+-----------+-----------+----------+------------
 logs-2020-01-05 | logs      | 2         | 1        | warm       
                 | this_week |           |          |            
-----------------+-----------+-----------+----------+------------
 logs-2020-01-06 | logs      | 2         | 1        | warm       
                 | this_week |           |          |            
-----------------+-----------+-----------+----------+------------
 logs-2020-01-07 | logs      | 2         | 1        | warm       
                 | this_week |           |          |            
-----------------+-----------+-----------+----------+------------
 logs-2020-01-08 | logs      | 2         | 1        | warm       
                 | this_week |           |          |            
-----------------+-----------+-----------+----------+------------
 logs-2020-01-09 | logs      | 2         | 1        | warm       
                 | this_week |           |          |            
-----------------+-----------+-----------+----------+------------
 logs-2020-01-10 | logs      | 2         | 1        | hot        
                 | this_week |           |          |            
                 | yesterday |           |          |            
-----------------+-----------+-----------+----------+------------
 logs-2020-01-11 | logs      | 2         | 1        | hot        
                 | this_week |           |          |            
                 | today     |           |          |            
-----------------+-----------+-----------+----------+------------

To use Kibana, navigate to the public IP address of the coordinator-1 node in your web browser and login with:

  • Username: elastic
  • Password: la_elastic_409
What are Hands-on Labs

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.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?