Lensedit

This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.

Lens provides you with a simple and fast way to create visualizations from your Elasticsearch data. With Lens, you can:

  • Quickly build visualizations by dragging and dropping data fields.
  • Understand your data with a summary view on each field.
  • Easily change the visualization type by selecting the automatically generated visualization suggestions.
  • Save your visualization for use in a dashboard.

Drag and dropedit

The data panel in the left column shows the data fields for the selected time period. When you drag a field from the data panel, Lens highlights where you can drop that field. The first time you drag a data field, you’ll see two places highlighted in green:

  • The visualization builder pane
  • The X-axis or Y-axis fields in the right column

You can incorporate many fields into your visualization, and Lens uses heuristics to decide how to apply each one to the visualization.

lens drag drop

Drag-and-drop capabilities are available only when Lens knows how to use the data. You can still customize your visualization if Lens is unable to make a suggestion.

Find the right dataedit

Lens shows you fields based on the index patterns you have defined in Kibana, and the current time range. When you change the index pattern or time filter, the list of fields are updated.

To narrow the list of fields you see in the left panel, you can:

  • Enter the field name in Search field names.
  • Click Filter by type, then select the filter. You can also select Only show fields with data to show the full list of fields from the index pattern.

Data summariesedit

To help you decide exactly the data you want to display, get a quick summary of each data field. The summary shows the distribution of values in the time range.

To view the data information, navigate to a data field, then click i.

lens data info

Change the visualization typeedit

With Lens, you are no longer required to build each visualization from scratch. Lens allows you to switch between any supported chart type at any time. Lens also provides suggestions, which are shortcuts to alternate visualizations based on the data you have.

You can switch between suggestions without losing your previous state:

lens suggestions

If you want to switch to a chart type that is not suggested, click the chart type in the top right, then select a chart type. When there is an exclamation point (!) next to a chart type, Lens is unable to transfer your current data, but still allows you to make the change.

Customize the data for your visualizationedit

Lens allows some customizations of the data for each visualization.

  1. Change the index pattern.

    1. In the left column, click the index pattern name.
    2. Select the new index pattern.

      If there is a match, Lens displays the new data. All fields that do not match the index pattern are removed.

  2. Change the data field options, such as the aggregation or label.

    1. Click Drop a field here or the field name in the right column.
    2. Change the options that appear depending on the type of field.

Layers in bar, line, and area chartsedit

The bar, line, and area charts allow you to layer two different series. To add a layer, click +.

To remove a layer, click the chart icon next to the index name:

lens remove layer

Lens tutorialedit

Ready to create your own visualization with Lens? Use the following tutorial to create a visualization that lets you compare sales over time.

Before you beginedit

To start, you’ll need to add the sample ecommerce data.

Build the visualizationedit

Drag and drop your data onto the visualization builder pane.

  1. Open Visualize, then click Create visualization.
  2. On the New Visualization window, click Lens.
  3. In the left column, select the kibana_sample_data_ecommerce index.
  4. Click time filter calendar, then click Last 7 days. The list of data fields are updated.
  5. Drag and drop the taxful_total_price data field to the visualization builder pane.

    Lens tutorial

Lens has taken your intent to see taxful_total_price and added in the order_date field to show average order prices over time.

To break down your data, drag the category.keyword field to the visualization builder pane. Lens understands 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 3 categories:

Lens tutorial

Further customizationedit

Customize your visualization to look exactly how you want.

  1. In the right column, click Average of taxful_total_price.

    1. Change the Label to Sales, or a name that you prefer for the data.
  2. Click Top values of category.keyword.

    1. Increase Number of values to 10. The visualization updates in the background to show there are only six available categories.
  3. Look at the suggestions. None of them show an area chart, but for sales data, a stacked area chart might make sense. To switch the chart type:

    1. Click Stacked bar chart in the right column.
    2. Click Stacked area.

      Lens tutorial

Next stepsedit

Now that you’ve created your visualization in Lens, you can add it to a Dashboard.

For more information, see Dashboard.