Kibana: Data Views & Discover

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Checked on 2026-11-09 against Kibana 9.5.x. Tested with Elasticsearch 9.5.6 and Kibana 9.5.6 in the hands-on lab (trial licence): the data views API request created bookshelf-logs in the bookshelf space, and the ES|QL queries of this page ran against the lab data.

Discover is where an investigation starts. Before a chart is designed or a rule written, someone opens Discover, picks the data, narrows the time and reads documents until the failure becomes visible. Two concepts carry that workflow: the data view, which tells Kibana what to query, and Discover itself, the tool that searches, filters and aggregates it. This page covers both, the field-level customisation that makes data readable, the sessions that preserve a finding, and the analysis tools (pattern analysis, change point detection, the metrics grid) that turn raw documents into signals, with the changes since the Kibana 7 era that older books describe.

How the data got there is on Ingesting Monitoring Data, how it is stored on Data Streams, TSDS & Lifecycle, and the query languages used in Discover on Querying with KQL, ES|QL & PromQL. The Grafana counterpart of this workflow is Queries, Explore and Drilldown.

Data views

A data view (called an index pattern before Kibana 8) tells Kibana which indices, data streams or aliases to query. Discover and Lens use data views; ES|QL does not need one. Kibana creates data views for you in a few situations (sample data, a file upload with the option on, and Elastic integrations installed through Fleet) and you create your own for everything else. Views created by Fleet integrations, Elastic Security and Cases carry a Managed tag: you can use but not edit or delete them, and you customise one by duplicating it (on the Elastic Stack this applies since 9.4).

Creating a data view

In Stack Management, Data Views, the form asks for:

  • a name for display;

  • an index pattern that matches sources, where * is a wildcard (logs-*.otel-*), commas separate names without spaces and a leading minus excludes a source (-test3). The preview is capped at 100 matches on the Elastic Stack 9.0 to 9.5 and 10,000 on Serverless;

  • a timestamp field, the default time field for the global time filter. Without one, dashboards cannot apply their time filter to the view; for data that has no time, choose "I don’t want to use the time filter";

  • under advanced settings, whether to include hidden and system indices, and a custom data view ID such as logs-prod so the same ID can be reused across spaces and environments, which is what makes dashboards portable.

You need the Data View Management privilege and the view_index_metadata index privilege; a "Read only" badge means you cannot save. Cross-cluster search patterns use <remote_cluster_name>:<target> (for example cluster_one:logstash-*, with wildcards in the cluster name and exclusions such as -cluster_one:*) and are available on the Elastic Stack only; on Serverless, cross-project search takes its place. A data view can match a rollup index, but rollups are deprecated and the documentation says to use downsampling instead. A temporary (ad hoc) data view is created with "Use without saving" in Discover or Lens: it is private to you, lives until you leave the app or save it, and does not appear on the management page.

Data views as code

For the lab it is better to create the views with a script than by clicking, so the dashboards that follow can refer to a fixed ID. The Kibana data views API accepts a custom id and works per space with /s/<space>/api/data_views/data_view:

curl -X POST "http://localhost:5601/s/bookshelf/api/data_views/data_view" \
  -H "kbn-xsrf: true" -H "Content-Type: application/json" \
  -u "elastic:${ELASTIC_PASSWORD}" \
  -d '{
    "data_view": {
      "id": "bookshelf-logs",
      "name": "Bookshelf logs (OTel)",
      "title": "logs-*.otel-*",
      "timeFieldName": "@timestamp"
    },
    "override": true
  }'

Reference: Kibana API: create a data view. The Elastic documentation also describes a "Data views v2" API for scripts and CI/CD pipelines, which is generally available on Serverless and planned for the Elastic Stack; on the Stack use the endpoint above. ELASTIC_PASSWORD comes from the lab’s environment file.

Runtime fields, scripted fields and formats

A runtime field is computed at query time from a Painless script and is not stored in the index. Add one under Data Views with Add field (name, type, optional label, description and format, then the script and Preview), or directly from Discover and Lens. It does not change the Elasticsearch mapping. The documentation’s example computes kilobytes from a bytes field with emit(doc['bytes'].value / 1024). The cost is real: Elasticsearch uses indexed fields to shorten responses, so a filter on a runtime field scans, and the page warns that runtime fields can affect Kibana performance. Index what you filter on, and use runtime fields for occasional derived values.

Scripted fields are deprecated since 7.13 and their creation was removed in 9.0 (existing ones can still be edited or deleted; they are unavailable on Serverless). Migrate to runtime fields or to ES|QL, where EVAL does the same job in the query itself.

Field formatters change only how values are displayed: string (with transformations such as lower case or short dots), URL (link, image, audio, with {{value}} style templates), date, bytes and bits, duration (picoseconds up to years), percentage, number, colour or badge by range and, for histogram fields, a histogram formatter. Numeric fields get defaults from their meta.unit. Set them under Data Views, edit the field, Set format; Set custom label renames a field for display.

Discover

Discover searches and filters documents, shows the structure of fields, builds quick charts from aggregatable fields, and saves what you found. It has two query modes. Classic mode uses a data view with KQL or Lucene plus filter pills; ES|QL mode needs no data view and names the source in the query. You can switch between them and Discover explains what happens to your query and filters when you do.

Classic mode

The data view selector picks the data, the time filter applies to the view’s timestamp field, and the query bar takes free text or KQL (for example service.name : bookshelf and log.level : error on ECS data). Filters (Add filter: field, operator, value) can be pinned, edited, negated, disabled or deleted. The field list shows each field, its top 10 values and the number of records sampled, and a plus icon adds it as a column; the document table shows a time column and a Summary column until you add fields, and supports in-table search and comparing documents. Discover tabs are a preview since 9.2 on the Elastic Stack, and the Inspect tab is generally available since 9.4.

ES|QL mode

Select Query in ES|QL (named Try ES|QL in earlier versions). The first command, usually FROM, names the source; later commands are chained with pipes; Search runs the query. Discover uses @timestamp for the time filter and the chart over time, and the chart counts every matching result in the range, not just the rows in the table. The table shows up to 1,000 rows unless you set a LIMIT. After STATS the rows are groups, and a chart built after KEEP uses only the returned rows. Sessions in this mode store the query, not the results.

FROM logs-*.otel-*
| WHERE service.name == "bookshelf" AND severity_text == "ERROR"
| STATS errors = COUNT(*) BY bucket = BUCKET(@timestamp, 1 minute)
| SORT bucket ASC

The query uses field names of the OpenTelemetry data in the lab; check the real names in the field list first. In the Discover editor, interactive browsers for data sources and fields are generally available since 9.4. The full ES|QL language is on Querying with KQL, ES|QL & PromQL.

Discover sessions

What older material calls a saved search is now a Discover session. The save dialog takes a title, description and tags and, for time-based data, "Store time with Discover session" to keep the time filter and refresh interval. Each tab stores its query mode, query, filters, data view, layout, chart and ES|QL variable controls. You need Create and Edit permissions on Saved Objects. Save as creates a copy (from 9.4; earlier 9.x versions use the "Save as new Discover session" toggle), and on Serverless and from 9.5 an Add to dashboard option puts the session straight on a dashboard, while the session always goes to the library. Panels from the library stay linked, so editing the session updates every dashboard that shows it. JSON export of a session is a preview on Serverless and planned on the Stack.

CSV export has limits that depend on mode and version:

Deployment ES|QL mode Classic mode

Serverless

10,000 rows or 250 MB, not configurable

100,000 rows or 250 MB, not configurable

Elastic Stack 9.3 and later

10,000 rows or 250 MB by default, configurable through xpack.reporting.csv settings

10,000 rows or 250 MB by default, configurable

Elastic Stack 9.0 to 9.2

10,000 rows or 250 MB by default

250 MB by default, no row limit

Logs in Discover

Logs Explorer and the Logs Stream, which older Observability material uses to read logs, were removed in Kibana 9.0. The 9.0 release notes point to Discover, which was improved to be the logs exploration experience, and to Discover sessions for log streams. The Observability documentation describes Discover as the place to search, filter and tail all logs in Elasticsearch without visiting servers, see the structure of fields and chart findings, and to use machine learning for log anomalies and categorisation. For Bookshelf this means one Discover session on the logs view, filtered to service.name bookshelf, with the columns @timestamp, severity_text and the log body.

Source: Elastic: Explore logs and, for the removal, the archived Kibana 9.0.0 release notes.

Pattern analysis

Pattern analysis groups log messages in a text field by their structure, so ten thousand lines collapse into a handful of patterns and the rare one stands out. In Discover select Patterns (or View as, Patterns, depending on version): the results appear under the chart with each pattern’s distribution and example documents, a field selector chooses the analysed field, and "Minimum time range" widens the window used to compute patterns for better accuracy. You can show only matching documents, hide them, or create a categorisation anomaly detection job from the Patterns view. It is generally available on Serverless and the Elastic Stack; the ES|QL CATEGORIZE grouping function is a preview on Serverless and in the Stack since 9.4.

Change point detection

Change point detection finds statistically significant changes in a metric over time through the ES|QL CHANGE_POINT command. You write a query that aggregates to a numeric value per time bucket and pipe it into the command; Discover charts each series, marks the changes (spikes, dips, shifts in distribution or trend) and lists them, with a lower p-value meaning a more significant change. Adding fields to BY treats each combination as its own series. The command needs at least 22 values per series, so widen the range or shrink the bucket if nothing is found. It is generally available on Serverless (all project types) and in the Elastic Stack since 9.5, where it requires a Platinum or Enterprise subscription or a trial.

FROM logs-*.otel-*
| WHERE service.name == "bookshelf" AND severity_text == "ERROR"
| STATS errors = COUNT(*) BY bucket = BUCKET(@timestamp, 1 minute)
| CHANGE_POINT errors ON bucket

Reference: Elastic: Detect change points in time series data; the ON clause follows the ES|QL CHANGE_POINT command reference at ES|QL: CHANGE_POINT.

The metrics grid

When Discover detects metrics data it builds a grid of charts automatically. Any data in a metrics-* index is treated as metrics data, the data stream’s index mode must be time series, and the view only exists in ES|QL mode: the query starts with TS, for example TS metrics-*. You can search and filter the metrics, break a chart down by up to five dimensions (only fields mapped as time series dimensions), view the query behind a chart and add charts to dashboards or cases. Default aggregations are sum for counters, average for gauges and the 95th percentile for histograms, and the Configuration flyout changes them. Dimension breakdown and histogram support are generally available since 9.4; filtering by clicking a chart value or with a WHERE clause also arrived in 9.4 (a preview in 9.2 and 9.3), while changing the default aggregation and sorting by recently explored are planned for the Elastic Stack and generally available on Serverless. Histograms are best stored as tdigest or exponential_histogram; legacy histogram fields work with an approximate-value warning.

Verify it in the lab

  1. Create the bookshelf-logs data view with the script above, plus a second one with the ID bookshelf-metrics and the pattern metrics-*.otel-*.

  2. Open Discover, choose Bookshelf logs, set the range to the last 15 minutes and enter service.name : bookshelf in the query bar; expect documents once the load generator runs.

  3. Switch the load generator to its failing-request mode and add the filter severity_text is ERROR; the histogram should rise. Select Patterns and note the dominant message pattern of the injected failures.

  4. Switch to ES|QL mode, run the STATS ... BUCKET query of this page and confirm the same rise.

  5. Run the CHANGE_POINT query over a range that includes the moment the failures started; on the Stack this needs the subscription or trial noted above.

  6. Save the classic view as a Discover session titled "Bookshelf errors" with Store time enabled, reopen it from Open session and confirm that it reruns.

  7. Switch to the metrics data view in ES|QL mode with TS metrics-*.otel-* and look for the metrics grid.

What can go wrong

  • Empty Discover. The time range excludes the data, the data view has no timestamp field, or the index pattern matches nothing; check the pattern preview and the range first.

  • Different field names than expected. ECS and OpenTelemetry data differ (log.level or severity_text); read the field list, not a book.

  • Slow runtime fields. A runtime field in a filter or a dashboard control is evaluated per document; index the underlying field or move the logic to ingest.

  • Scripted fields reappear. A migrated dashboard that depends on one breaks when the field is deleted; replace it before upgrading.

  • Truncated results. ES|QL tables stop at 1,000 rows by default and CSV exports at the limits above; state a LIMIT and export deliberately.

  • Change point finds nothing. Fewer than 22 values per series; widen the range or reduce the bucket size.

  • Licence surprises. Change point detection needs Platinum or Enterprise on the Stack; check before building a runbook on it.

In the books

Several books describe this area in the Kibana 7 vocabulary. Paro’s Elasticsearch 7.0 Cookbook (chapter 11, "Managing Kibana discovery") presents the Discover page for exploring and saving views on index patterns, Saurabh Chhajed’s Learning ELK Stack (chapters 1 and 8) searches on the Discover page of Kibana 4, and Shah’s Kibana 8.x Quick Start Guide (chapter 9) introduces ES|QL and runtime fields on Elasticsearch 8.11. What has changed: index patterns became data views, saved searches became Discover sessions, scripted fields were removed in favour of runtime fields and ES|QL, Logs Explorer was removed, and Discover gained ES|QL mode, pattern analysis, change point detection and a metrics grid. Treat the ES|QL chapter with care: it describes keywords as case-sensitive, whereas the current reference says they are case-insensitive, so check each query against the official reference.

Where to go next