﻿---
title: How to query in Discover's ES|QL mode
description: Query your data in Discover with ES|QL, browse data sources and fields, add variable controls, and enrich results with lookup indices.
url: https://www.elastic.co/docs/explore-analyze/discover/use-esql
products:
  - Elastic Documentation
  - Kibana
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available
---

# How to query in Discover's ES|QL mode
In ES|QL mode, you write a query in [ES|QL](https://docs-edge.elastic.dev/docs/reference/query-languages/esql), the Elasticsearch query language, and **Discover** shows the results. The query says which data to read and can also filter, calculate, and summarize it. For example, `FROM kibana_sample_data_logs | WHERE bytes > 5000` returns the sample web log entries that transferred more than 5,000 bytes.

## Write and refine your queries

- Learn by running your [first ES|QL query](https://www.elastic.co/docs/explore-analyze/discover/try-esql) step by step on sample data.
- [Browse data sources and fields](https://www.elastic.co/docs/explore-analyze/discover/browse-esql-sources) from the editor to find an index or a field name while you write a query.
- Use the [ES|QL editor](https://www.elastic.co/docs/explore-analyze/query-filter/languages/esql-kibana) to get suggestions as you type, error fixes, and, when an AI model is configured, AI-generated queries.
- Add [variable controls](https://www.elastic.co/docs/explore-analyze/discover/esql-variable-controls) to make a query dynamic without having to duplicate it.
- Read, sort, and filter [ES|QL results](https://www.elastic.co/docs/explore-analyze/discover/esql-results) in the table.
- Create [lookup indices](https://www.elastic.co/docs/explore-analyze/discover/create-lookup-indices) to enrich your results with `LOOKUP JOIN`.
- [Switch to classic mode](https://www.elastic.co/docs/explore-analyze/discover/switch-esql-mode) and see what happens to your query.


## Related pages

- [How Discover works](https://www.elastic.co/docs/explore-analyze/discover/discover-get-started)
- [Explore your data in Discover](https://www.elastic.co/docs/explore-analyze/discover/explore-data)
- [Manage your Discover view and sessions](https://www.elastic.co/docs/explore-analyze/discover/manage-discover)
- [Lens visualizations using ES|QL queries](https://www.elastic.co/docs/explore-analyze/visualize/esorql)