Thursday , April 18 2024

How To Create an Elasticsearch Indice(Index) using Kibana

Before reading this article, you may want to read the following article to learn the concepts related to Elasticsearch.

What is Elasticsearch

We determine the number of replica and shard during indice creation. For example, when we create an indice with 16 shard and 2 replicas in a system with 3 data nodes, elasticsearch distributes the data to data nodes as follows.

As you can see in the screenshot below, a copy of each shard was created because we set the replica as 2. In order to monitor Nodes, Indices and Shards in Elasticsearch, I suggest you read the article “How To Monitor Elasticsearch Nodes, Indices and Shards Using Kibana“.

Create an Elasticsearch indice

First, we’re connecting to Kibana. To connect to Kibana, you can read the article “How To Install Kibana On Centos“.

Then click on “Dev Tools” to create an index with 2 replicas and 16 shard using the command below. The number_of_replicas value must be 1 for 2 replica. To complete the process, click to “click to send request”.

If the script has been successfully completed and the indice is created, the values “true” should return as a result, as you can see in the screenshot below.

When creating Indices, we can ensure that the shards and replicas are created only on certain data nodes. To do this, we open the elasticsearch.yml file on each data node and define a rack name. For example, the r1 name is defined as the rack name in the example below.

After performing this operation on all data nodes, we can specify the nodes in which shards and replicas will be created when creating indices.

Or you can specify IP and VLAN as below.

Specify IP:

Specify VLAN:

Mapping

Usually, we transfer our data from other database systems to elasticsearch. If we don’t perform mapping in elasticsearch, columns are transferred to elasticsearch as text. Therefore, it is more effective to create each column with specified type in index(this is mapping) before transfer our data.

You can see an indice create script with all elasticsearch core dataypes below.

Loading

About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories