0
0
ElasticsearchHow-ToBeginner · 4 min read

How to Create Visualization in Kibana: Step-by-Step Guide

To create a visualization in Kibana, open the Visualize Library, click Create visualization, and select the type you want (like bar chart or pie chart). Then, choose the data source (index pattern), configure the metrics and buckets, and save your visualization.
📐

Syntax

Creating a visualization in Kibana follows this pattern:

  • Open Visualize Library: Access the visualization section in Kibana.
  • Create Visualization: Click the button to start a new visualization.
  • Select Visualization Type: Choose from options like bar chart, line chart, pie chart, or data table.
  • Choose Data Source: Pick an index pattern that matches your Elasticsearch data.
  • Configure Metrics and Buckets: Define what data to measure (metrics) and how to group it (buckets).
  • Save Visualization: Give it a name and save for later use or dashboard inclusion.
plaintext
1. Open Kibana and go to Visualize Library
2. Click 'Create visualization'
3. Select visualization type (e.g., Bar chart)
4. Choose index pattern (e.g., 'logstash-*')
5. Configure metrics (e.g., Count) and buckets (e.g., Date histogram on '@timestamp')
6. Click 'Save' and name your visualization
💻

Example

This example shows how to create a simple bar chart visualization that counts documents over time.

plaintext
1. Open Kibana and navigate to Visualize Library.
2. Click 'Create visualization'.
3. Select 'Bar chart' as the visualization type.
4. Choose your index pattern, for example, 'logstash-*'.
5. Under 'Metrics', select 'Count' to count documents.
6. Under 'Buckets', add a 'Date Histogram' aggregation on the '@timestamp' field.
7. Adjust the interval (e.g., auto or daily).
8. Click 'Apply changes' to see the chart.
9. Click 'Save', name it 'Documents Over Time', and save.
Output
A bar chart showing the count of documents grouped by time intervals (e.g., days) on the x-axis and count on the y-axis.
⚠️

Common Pitfalls

Some common mistakes when creating visualizations in Kibana include:

  • Choosing the wrong index pattern that does not match your data.
  • Not selecting the correct field type for aggregation (e.g., using a text field instead of a numeric or date field).
  • Forgetting to apply changes after configuring metrics and buckets, so the visualization does not update.
  • Using too large time ranges without proper interval settings, causing slow or empty visualizations.

Always verify your data fields and refresh the visualization after changes.

plaintext
/* Wrong: Using a text field for a date histogram */
Buckets: Date Histogram on 'message' (text field)  

/* Right: Using a date field for a date histogram */
Buckets: Date Histogram on '@timestamp' (date field)
📊

Quick Reference

StepDescription
Open Visualize LibraryAccess visualization tools in Kibana
Create VisualizationStart a new visualization project
Select TypePick chart type like bar, pie, or line
Choose Index PatternSelect data source matching your Elasticsearch data
Configure MetricsDefine what to measure (e.g., count, average)
Configure BucketsGroup data by fields or time intervals
Apply ChangesUpdate visualization with your settings
Save VisualizationName and save for reuse or dashboards

Key Takeaways

Start creating visualizations from the Visualize Library in Kibana.
Choose the right index pattern and field types for accurate data aggregation.
Configure metrics to measure data and buckets to group data effectively.
Always apply changes to refresh the visualization preview.
Save your visualization to reuse it or add it to dashboards.