﻿---
title: Switch between ES|QL and classic mode
description: Switch Discover between ES|QL and classic mode, and see what happens to your query, filters, and the mode Discover opens next.
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8392/explore-analyze/discover/switch-esql-mode
products:
  - Elastic Documentation
  - Kibana
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available
---

# Switch between ES|QL and classic mode
**Discover** has two query modes: ES|QL, and classic mode, which uses data views with Kibana Query Language (KQL) or Lucene. Switch when you want the query to select the data, or when you want the data view and filter bar back. This page explains what Discover does with the query you already have.

## Before you begin

- You need a **Discover** session. If you are new to ES|QL mode, start with [Get started with ES|QL in Discover](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8392/explore-analyze/discover/try-esql).


## Switch to ES|QL

1. Open the Discover tab you want to switch.
2. Switch from either location:
   - `code` **Query in ES|QL** (**ES|QL** or **Try ES|QL** in earlier versions) in the application menu.
- <applies-to>Elastic Stack: Generally available since 9.4</applies-to> <applies-to>Elastic Cloud Serverless: Generally available</applies-to> **Switch to ES|QL** in the contextual menu (`boxes_vertical`) of the active Discover tab. This affects only that tab.

If you've entered a KQL or Lucene query in classic mode, Discover converts it to ES|QL when you switch:
- The query text becomes an ES|QL query.
- <applies-to>Elastic Cloud Serverless: Generally available</applies-to> <applies-to>Elastic Stack: Generally available since 9.4</applies-to> Active filters from the filter bar become `WHERE` clauses where possible.
- <applies-to>Elastic Cloud Serverless: Generally available</applies-to> <applies-to>Elastic Stack: Generally available since 9.4</applies-to> Filters that can't be converted, such as scripted filters, are dropped.

<applies-to>Elastic Cloud Serverless: Generally available</applies-to> <applies-to>Elastic Stack: Generally available since 9.4</applies-to> Discover remembers the query mode you last used. A new Discover session opens in that mode.
<applies-to>Elastic Cloud Serverless: Generally available</applies-to> <applies-to>Elastic Stack: Planned</applies-to> By default, Discover derives your starting query from your data sources. Administrators can set a different starting query for the space with the [**Default ES|QL query** (`discover:defaultEsqlQuery`)](https://docs-v3-preview.elastic.dev/elastic/kibana/tree/main/reference/advanced-settings#kibana-discover-settings) setting. This setting doesn't apply after you edit the query or switch query modes.
**Result:** The tab opens in ES|QL mode. A KQL or Lucene query you had already entered is converted into the ES|QL editor.

## Revert to Discover's classic mode

You can go back to the classic data view and KQL mode in Discover at any time. When you switch from ES|QL mode to classic mode, Discover discards the ES|QL query, including one it built by converting KQL or Lucene, and opens classic mode with an empty KQL query.
<applies-switch>
  <applies-item title="{serverless:, stack: ga 9.4+ }" applies-to="Elastic Cloud Serverless: Generally available, Elastic Stack: Generally available since 9.4">
    1. Open the Discover tab that you want to switch to classic mode.
    2. Switch the active tab from either location:
       - From the tab's contextual menu (`boxes_vertical`), select **Switch to classic**.
    - From the application menu, select **Switch to Classic**.
       This affects only the active Discover tab.

    <tip>
      The contextual menu **Switch to classic** option only appears for the currently active tab. To see it for another tab, you must load that tab first.
    </tip>
  </applies-item>

  <applies-item title="stack: ga 9.2-9.3" applies-to="Elastic Stack: Generally available from 9.2 to 9.3">
    From the application menu, select **Switch to classic**. This only affects your current Discover tab.
  </applies-item>

  <applies-item title="stack: ga 9.0-9.1" applies-to="Elastic Stack: Generally available from 9.0 to 9.1">
    From the application menu, select **Switch to classic**.
  </applies-item>
</applies-switch>

**Result:** The tab opens in classic mode with an empty KQL query. The ES|QL query is gone.

## Next steps

- [Browse data sources and fields from the editor](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8392/explore-analyze/discover/browse-esql-sources)
- [Work with ES|QL results in Discover](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8392/explore-analyze/discover/esql-results)


## Related pages

- [Use Discover with ES|QL](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8392/explore-analyze/discover/use-esql)
- [Explore fields and data with Discover](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8392/explore-analyze/discover/discover-get-started)