Creating a Kibana graph

Using a Kibana graph, we can find how different Elasticsearch index items are associated with each other. We can check and see how indexed terms are connected and which connections are stronger. Through Kibana graphs, we can solve different problems such as recommending things or detecting fraud.

A graph is essentially a form of network that we can use to find related terms in an index. Each term that we add to the graph is known as vertices and the association between the two vertices is known as the connection. We can add different fields as vertices and can customize them with different colors and icons to make the graph more readable. Additionally, we have a search box where we can put in any search criteria after adding all of the vertices, to generate the connection between the vertices in the form of a graph view. Now, we are going to explore how to do graph analytics in the Elasticsearch index. Using this, we can explore the connections between different terms of the Elasticsearch index. Here, we will take the example of popular baby names data, which has been taken from the Data.gov website (https://catalog.data.gov/dataset/most-popular-baby-names-by-sex-and-mothers-ethnic-group-new-york-city-8c742). This is open data so we can freely download the data and use it.

The format of the data contains Year of Birth, Gender, Ethnicity, Child's First Name, Count, and Rank. The following example shows a snippet of the actual CSV data:

Year of Birth    Gender    Ethnicity                     Child's First Name    Count    Rank
2016 FEMALE ASIAN AND PACIFIC ISLANDER Olivia 172 1
2016 FEMALE ASIAN AND PACIFIC ISLANDER Chloe 112 2
2016 FEMALE ASIAN AND PACIFIC ISLANDER Sophia 104 3
2016 FEMALE ASIAN AND PACIFIC ISLANDER Emily 99 4
2016 FEMALE ASIAN AND PACIFIC ISLANDER Emma 99 4

The preceding dataset only displays the initial five lines of the actual CSV data that I have downloaded from the Data.gov website for popular baby names, but the actual file (Popular_Baby_Names.csv) contains 11,345 records.


We have covered index creation using Popular_Baby_Names.csv in Chapter 3, Business Analytics with Kibana, using Logstash.

So, here, we are going to use the same Elasticsearch index: popular-baby-names. In this index, we have popular baby names from different ethnicities; so, using this data, we will create a graph to understand the relation between the Child's First Name field and Ethnicity.

To perform the graph analytics on the popular baby names index, we need to perform the following steps:

  1. We need to click on the Graph link in the left-hand menu link of Kibana.
  2. In the Select index pattern drop-down menu, select the popular-baby-names index pattern.
  3. Now, click on the plus icon to add a field source for the vertices and filter it using Child's First Name. Then, click on the Add button to add it, as follows:

The preceding screenshot shows the screen to add the vertices for graph analytics. Here, we are adding the Child's First Name field of the popular-baby-names index.

After clicking on the Add button, it opens the field customization screen from where we can change the Color for vertices representation on the graph, change the Icon for the vertices, and change the Max terms per hop value. Additionally, there is a Remove button that we can use to remove the vertices from the graph display; take a look at the following screenshot:

In the preceding screenshot, we can see the customization option for the Child's First Name field. We can customize it if we want to do so:

  1. Again, click on the plus icon to add Ethnicity as another graph vertices, in the same way that we did for Child's First Name.

 

  1. In the search box, type in any value such as the name of a child, that is, tenzin, and then click on the Search button; this will open the following view:

In the preceding screenshot, we can see the graph view of the popular-baby-names index where we are trying to explore the relationship between names and ethnicity.

The right-hand side box provides us with a different option to play with the graph view. Take a look at the top icons in the box; the first option is to undo, the second option is to redo, and the third option is a plus icon. This is used to expand the selection; we can select any vertices and click on the plus icon to expand it further.

Next to this is the link icon that is used to add links between existing terms; then, there is a delete icon to remove the vertices from the workspace.

The sixth link is there to blacklist the selection from returning to the workspace, and the seventh is to apply custom styles on the selected vertices. The eight option is to drill down further, while the last (ninth) option allows you to play or pause the layout:

The preceding screenshot shows the top icons in the right-hand side box on the graph page. In this way, we can create the graph view using the index pattern.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.150.183