﻿---
title: ES|QL visualizations
description: You can add ES|QL visualizations to a dashboard directly from queries in Discover, or you can start from a dashboard. In Discover, typing ES|QL queries...
url: https://www.elastic.co/elastic/docs-builder/docs/2509/explore-analyze/visualize/esorql
products:
  - Kibana
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available in 9.0+
---

# ES|QL visualizations
You can add ES|QL visualizations to a dashboard directly from queries in Discover, or you can start from a dashboard.

## Edit and add from Discover

In Discover, [typing ES|QL queries](https://www.elastic.co/elastic/docs-builder/docs/2509/explore-analyze/query-filter/languages/esql-kibana) automatically shows a visualization. The visualization type depends on the content of the query: histogram, bar charts, etc. You can manually make changes to that visualization and edit its type and display options using the pencil button ![pencil button](https://www.elastic.co/elastic/docs-builder/docs/2509/explore-analyze/images/kibana-esql-icon-edit-visualization.svg).
You can then **Save** and add it to an existing or a new dashboard using the save button of the visualization ![save button](https://www.elastic.co/elastic/docs-builder/docs/2509/explore-analyze/images/kibana-esql-icon-save-visualization.svg).

## Create from dashboard

1. Add a new panel from your dashboard.
   - <applies-to>Elastic Cloud Serverless: Generally available</applies-to> <applies-to>Elastic Stack: Generally available since 9.2</applies-to> Select **Add** > **New panel** in the toolbar.
- <applies-to>Elastic Stack: Generally available from 9.0 to 9.1</applies-to> Click **Add panel** in the dashboard toolbar.
   <tip>
   If you haven't created a [data view](https://www.elastic.co/elastic/docs-builder/docs/2509/explore-analyze/find-and-organize/data-views) and you don't have a dashboard yet, the **Dashboards** page offers you the possibility to **Try ESQL** right away. By selecting this option, a dashboard is created with an ESQL visualization that you can interact with and configure using ESQL.
   </tip>
2. Choose **ESQL** under **Visualizations**. An ESQL editor appears and lets you configure your query and its associated visualization. The **Suggestions** panel can help you find alternative ways to configure the visualization.
   <tip>
   Check the [ES|QL reference](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2509/reference/query-languages/esql) to get familiar with the syntax and optimize your query.
   </tip>
3. When editing your query or its configuration, run the query to update the preview of the visualization.
   ![Previewing an ESQL visualization](https://images.contentstack.io/v3/assets/bltefdd0b53724fa2ce/blt69dcceb4f1e12bc1/66c752d6aff77d384dc44209/edit-esql-visualization.gif)
   <note applies-to="Elastic Cloud Serverless: Generally available, Elastic Stack: Generally available since 9.1">
   When you edit the query and run it again, the visualization configuration persists as long as it is compatible with the query changes. Refer to [ES|QL visualizations > Chart configuration persistence over ES|QL query update](#chart-config-persist) for more details.
   </note>
4. You can bind controls to your ESQL visualizations in dashboards by creating [ES|QL controls](/elastic/docs-builder/docs/2509/explore-analyze/dashboards/add-controls#add-variable-control).
5. Select **Apply and close** to save the visualization to the dashboard.


### Customize the appearance of your ES|QL visualization

When editing an ES|QL visualization, you can customize the appearance of the chart. To do that:
1. Click one of the fields representing an axis of the chart to open its details.
   ![Click on the axis field to open its details](https://www.elastic.co/elastic/docs-builder/docs/2509/explore-analyze/images/esql-visualization-customize-axis.png)
2. Define the appearance of your choice from the available options.
   ![Appearance customization options for ESQL charts](https://www.elastic.co/elastic/docs-builder/docs/2509/explore-analyze/images/esql-visualization-customization-options.png)
3. Return to the previous menu, then **Apply and close** the configuration to save your changes.


### Chart configuration persistence over ES|QL query update

<applies-to>
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available since 9.1
</applies-to>

When you edit the ES|QL query and run it again, the visualization configuration persists as you defined it as long as it is compatible with the query changes.
The chart configuration resets or follows automatic suggestions when:
- <applies-to>Elastic Stack: Generally available since 9.2</applies-to> You manually select a different chart type incompatible with the one previously selected.
- <applies-to>Elastic Stack: Generally available since 9.2</applies-to> You create a new chart and haven't edited the visualization's options yet.
- The query changes significantly and no longer returns compatible columns.


## Create an alert from your ES|QL visualization

<applies-to>
  - Serverless Elasticsearch projects: Generally available
  - Serverless Observability projects: Generally available
  - Serverless Security projects: Unavailable
  - Elastic Stack: Generally available since 9.1
</applies-to>

Once you've created an ES|QL panel, you can create an Elasticsearch threshold rule directly from the visualization panel, based on the data it displays. When you do this, the rule query is automatically generated and either describes the data and sets a specific threshold, or describes the data without setting a specific threshold.
<note>
  Elastic Security rule types are not supported.
</note>

To create a rule with the threshold pre-specified:
- Right-click a data point in the visualization and click **Add alert rule**. This opens the **Create rule** flyout. The generated query will define a threshold that corresponds to the data point you selected.
- [Configure](https://www.elastic.co/elastic/docs-builder/docs/2509/solutions/observability/incident-management/create-an-elasticsearch-query-rule) your Elasticsearch rule.

To create a rule without the threshold pre-specified:
- Open the **More actions** (three dots) menu in the upper right of the panel and select **Add alert rule**. This opens the **Create rule** flyout. The generated query will define a threshold that corresponds to the data point you selected.
- [Configure](https://www.elastic.co/elastic/docs-builder/docs/2509/solutions/observability/incident-management/create-an-elasticsearch-query-rule) your Elasticsearch rule.