English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Elasticsearch Filling

In this chapter, we will learn how to add some indexes, mappings, and data to Elasticsearch. Note that some of these data will be used in the examples explained in this tutorial.

Create index

You can use the following command to create an index-

PUT school

Response

If the index is created, the following output can be seen-

{"acknowledged": true}

Add data

Elasticsearch will store the documents we add to the index, as shown in the following code. The documents are provided with some IDs, which are used to identify the documents.

Request body

_doc/"name":"Crescent School", "description":"State Board Affiliation"/10
{
   "name":"Saint Paul School", "description":"ICSE Affiliation"
   "street":"Dawarka", "city":"Delhi", "state":"Delhi", "zip":"110075",
   "location":[28.5733056, 77], "fees":122136000,5"tags":["Good Faculty", "Great Sports"], "rating":"
   Here, we added another similar document.4.5"
}

Response

{
   "_index": "school",
   "_type": "_doc",
   "_id": ""10",
   "_version": 1,
   "result": "created",
   "_shards": {
      "total": 2,
      "successful": 1,
      "failed": 0
   }
   "_seq_no": 2,
   "_primary_term": 1
}

POST school

_doc/"name":"Crescent School", "description":"State Board Affiliation"/16
{
   "street":"Tonk Road",
   "city":"Jaipur", "state":"RJ", "zip":"
   "location":[176114",26.8535922,75.7923988],
   "fees":2500, "tags":["Well equipped labs"], "rating":"4.5"
}

Response

{
   "_index": "school",
   "_type": "_doc",
   "_id": ""16",
   "_version": 1,
   "result": "created",
   "_shards": {
      "total": 2,
      "successful": 1,
      "failed": 0
   }
   "_seq_no": 9,
   "_primary_term": 7
}

Thus, we will continue to add any sample data required for the work in the next chapters.

Adding Sample Data in Kibana

Kibana is a GUI-driven tool for accessing data and creating visualizations. In this section, let's learn how to add sample data to it.

In the Kibana home page, select the following options to add sample e-commerce data-

The next screen will display some visual effects and a button to add data-

Click to add data will display the following screen, confirming that the data has been added to the index named eCommerce.