2019-11-19 17:24:22 +01:00
[role="xpack"]
[[lens]]
== Lens
beta[]
2020-05-28 23:39:16 +02:00
*Lens* is a simple and fast way to create visualizations of your {es} data. With *Lens*,
you drag and drop your data fields onto the visualization builder pane, and *Lens* automatically generates
a visualization that best displays your data.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
With Lens, you can:
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
* Explore your data in just a few clicks.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
* Create visualizations with multiple layers and indices.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
* Use the automatically generated visualization suggestions to change the visualization type.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
* Add your visualizations to dashboards and Canvas workpads.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
To get started with *Lens*, click a field in the data panel, then drag and drop the field on a highlighted area.
2019-11-19 17:24:22 +01:00
[role="screenshot"]
image::images/lens_drag_drop.gif[]
2020-05-28 23:39:16 +02:00
You can incorporate many fields into your visualization, and Lens uses heuristics to decide how to apply each one to the visualization.
TIP: Drag-and-drop capabilities are available only when Lens knows how to use the data. If *Lens* is unable to automatically generate a visualization,
you can still configure the customization options for your visualization.
2019-11-19 17:24:22 +01:00
[float]
[[apply-lens-filters]]
2020-05-28 23:39:16 +02:00
==== Filter the data panel fields
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
The fields in the data panel based on your selected <<index-patterns, index pattern>>, and the <<set-time-filter,time filter>>.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
To change the index pattern, click it, then select a new one. The fields in the data panel automatically update.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
To filter the fields in the data panel:
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
* Enter the name in *Search field names*.
* Click *Filter by type*, then select the filter. To show all of the fields in the index pattern, deselect *Only show fields with data*.
2019-11-19 17:24:22 +01:00
[float]
[[view-data-summaries]]
==== Data summaries
2020-05-28 23:39:16 +02:00
To help you decide exactly the data you want to display, get a quick summary of each field. The summary shows the distribution of values in the time range.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
To view the field summary information, navigate to the field, then click *i*.
2019-11-19 17:24:22 +01:00
[role="screenshot"]
2019-12-16 18:15:00 +01:00
image::images/lens_data_info.png[]
2019-11-19 17:24:22 +01:00
[float]
[[change-the-visualization-type]]
==== Change the visualization type
2020-05-28 23:39:16 +02:00
*Lens* enables you to switch between any supported visualization type at any time.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
*Suggestions* are shortcuts to alternate visualizations that *Lens* generates for you.
2019-11-19 17:24:22 +01:00
[role="screenshot"]
image::images/lens_suggestions.gif[]
2020-05-28 23:39:16 +02:00
If you'd like to use a visualization type that is not suggested, click the visualization type,
then select a new one.
[role="screenshot"]
image::images/lens_viz_types.png[]
When there is an exclamation point (!)
next to a visualization type, Lens is unable to transfer your data, but
2019-11-19 17:24:22 +01:00
still allows you to make the change.
[float]
[[customize-operation]]
2020-05-28 23:39:16 +02:00
==== Change the aggregation and labels
2019-11-19 17:24:22 +01:00
Lens allows some customizations of the data for each visualization.
2020-05-28 23:39:16 +02:00
. Click *Drop a field here* or the field name in the column.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
. Change the options that appear depending on the type of field.
2019-11-19 17:24:22 +01:00
[float]
[[layers]]
2020-05-28 23:39:16 +02:00
==== Add layers and indices
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
Bar, line, and area charts allow you to visualize multiple data layers and indices so that you can compare and analyze data from multiple sources.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
To add a layer, click *+*, then drag and drop the fields for the new layer. To view a different index, click it, then select a new one.
2019-11-19 17:24:22 +01:00
[float]
[[lens-tutorial]]
=== Lens tutorial
Ready to create your own visualization with Lens? Use the following tutorial to create a visualization that
lets you compare sales over time.
[float]
[[lens-before-begin]]
==== Before you begin
To start, you'll need to add the <<add-sample-data, sample ecommerce data>>.
[float]
==== Build the visualization
Drag and drop your data onto the visualization builder pane.
2020-05-28 23:39:16 +02:00
. From the menu, click *Visualize*, then click *Create visualization*.
2019-11-19 17:24:22 +01:00
. On the *New Visualization* window, click *Lens*.
2020-05-28 23:39:16 +02:00
. Select the *kibana_sample_data_ecommerce* index pattern.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
. Click image:images/time-filter-calendar.png[], then click *Last 7 days*.
+
The fields in the data panel update.
2019-11-19 17:24:22 +01:00
. Drag and drop the *taxful_total_price* data field to the visualization builder pane.
+
[role="screenshot"]
image::images/lens_tutorial_1.png[Lens tutorial]
2020-05-28 23:39:16 +02:00
To display the average order prices over time, *Lens* automatically added in *order_date* field.
2019-11-19 17:24:22 +01:00
To break down your data, drag the *category.keyword* field to the visualization builder pane. Lens
2020-05-28 23:39:16 +02:00
knows that you want to show the top categories and compare them across the dates,
and creates a chart that compares the sales for each of the top three categories:
2019-11-19 17:24:22 +01:00
[role="screenshot"]
image::images/lens_tutorial_2.png[Lens tutorial]
[float]
[[customize-lens-visualization]]
2020-05-28 23:39:16 +02:00
==== Customize your visualization
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
Make your visualization look exactly how you want with the customization options.
2019-11-19 17:24:22 +01:00
2020-04-09 19:42:30 +02:00
. Click *Average of taxful_total_price*.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
.. Change the *Label* to `Sales`.
2019-11-19 17:24:22 +01:00
. Click *Top values of category.keyword*.
2020-05-28 23:39:16 +02:00
.. Change *Number of values* to `10`. The visualization updates to show there are only
2019-11-19 17:24:22 +01:00
six available categories.
2020-05-28 23:39:16 +02:00
+
Look at the *Suggestions*. An area chart is not an option, but for sales data, a stacked area chart might be the best option.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
. To switch the chart type, click *Stacked bar chart* in the column, then click *Stacked area* from the *Select a visualizations* window.
2019-11-19 17:24:22 +01:00
+
[role="screenshot"]
image::images/lens_tutorial_3.png[Lens tutorial]
[float]
[[lens-tutorial-next-steps]]
==== Next steps
2020-05-28 23:39:16 +02:00
Now that you've created your visualization, you can add it to a dashboard or Canvas workpad.
2019-11-19 17:24:22 +01:00
2020-05-28 23:39:16 +02:00
For more information, refer to <<dashboard,Dashboard>> or <<canvas,Canvas>>.