How to Create an Index Using Kibana

Have a Database Problem? Speak with an Expert for Free
Get Started >>

Introduction

If you’re familiar with Mongo or SQL databases, an index has the same function as those database technologies. Just like a database, an index holds documents. Databases use tables to differentiate between the kinds of documents while indexes characterize by document type. The latter lets you dig deep into the meaning of your data. With Kibana you can create stunning visuals in the form of interactive charts, graphs, and mapping capabilities arranged in ways that bring your data to life. You begin to uncover new meaningful insights. Get started by following this step-by-step tutorial. We’ll show you how to easily create an index using Kibana in Elasticsearch.

If you’re already familiar with Kibana and would rather skip the tutorial and go straight to the code, click here to go to Just The Code

Prerequisites

  • Elasticsearch – The popular query and analytical search engine that meets your data structuring needs. Install and then run the application.

  • Kibana – Elasticsearch’s answer to interactive data exploration and limitless graphic elements for a true understanding of the details that matter. Install and then run the application.

Create an Index Using Kibana

Manually create an index with the Create Index API

The Create Index API is part of index management. It lets you use the PUT command to create a basic index rather quickly. Let’s look at an example. We opened the Kibana Dev Tools Console and created demo_index.

1
PUT demo_index

A confirmation message prompt acknowledges that the index was created correctly.

1
2
3
4
5
{
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "demo_index"
}

Kibana has index naming restrictions. These actually safeguards your documents to some extent by not introducing conflicting file extension properties to your files. That’s nice. Think of it as Kibana’s way of doing what they can to protect your documents. Here are some of the rules you’ll want to abide by when you name your index files:

  • Must be lowercase
  • Indices must not include <, >, ?, ", |, ,, # \, /, *,   (the space character)

Please view the complete list of index naming limitations.

Customize it in JSON format

When you set the parameters for the replicas and shards numbers, you customize it the way you like. Below is an example in JSON format.

1
2
3
4
5
6
7
8
9
PUT demo_index
{
"settings" : {
"index" : {
"number_of_shards" : 3,
"number_of_replicas" : 2
}
}
}

Here we received the ackowledgement of both requests, so all is well.

1
2
3
4
5
{
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "demo_index"
}

Kibana gives you many opportunities to personalize your indices. To further tailor them, change the settings. After you do that, you’ll want to update them. Since this tutorial is about creating an index in Kibana, we won’t go into extreme detail on updating indices. However, it’s important to know that this can be done because it’s related to index creation. To give you a brief overview, you can update them in real time for all or just one of the settings for indices when you use the PUT command with the REST endpoint /_settings. You can also prevent current settings from updating when you have “true” as the setting for the `reserve_request’ parameter.

If you want to update the settings for just one or a few indices, use {index}/_settings. For example, say you created a Pinterest index. Now, you want to change its settings. Start by making the REST endpoint PUT /pinterest/_settings. Follow through with the settings code line, number of replicas code line, and numbers of shards code line as you normally would.

To change the settings for all indices, the REST endpoint is PUT /_settings. Follow through with the settings code line, number of replicas code line, and numbers of shards code line as you normally would there too.

Read more about changing, updating, and preventing indices from updating in real time in Elasticsearch’s documenation.

Conclusion

In this tutorial, you learned how to create an index using Kibana. The Create Index API and the PUT command allow the fast creation of indices for ehanced interative views and analyzation. Like databases, indexes store files. One notable difference between the two is when you customize index settings, you become free to go beyond the constraints that come with basic databases. Learn more about Kibana today. Get ready to discover the hidden data that when revealed, you can base enlightened business decisions ahead of the competition.

If you need help managing the database for your project please don’t hesitate to reach an expert at Object Rocket.

Just the Code

Here’s the code if you want to bypass the step-by-step explanation of how to create an index using Kibana.

1
2
3
4
5
6
7
8
9
PUT demo_index
{
"settings" : {
"index" : {
"number_of_shards" : 3,
"number_of_replicas" : 2
}
}
}

Pilot the ObjectRocket Platform Free!

Try Fully-Managed CockroachDB, Elasticsearch, MongoDB, PostgreSQL (Beta) or Redis.

Get Started

Keep in the know!

Subscribe to our emails and we’ll let you know what’s going on at ObjectRocket. We hate spam and make it easy to unsubscribe.