Skip to content

[Discover] Add observability default ES|QL query#257268

Merged
cauemarcondes merged 14 commits intoelastic:mainfrom
weltenwort:add-observability-default-esql-query
Mar 26, 2026
Merged

[Discover] Add observability default ES|QL query#257268
cauemarcondes merged 14 commits intoelastic:mainfrom
weltenwort:add-observability-default-esql-query

Conversation

@weltenwort
Copy link
Copy Markdown
Member

@weltenwort weltenwort commented Mar 11, 2026

📝 Summary

This implements the getDefaultEsqlQuery accessor for the observability root profile. It also makes the logs locator from logs_shared aware of the discover.isEsqlDefault feature flag so the observability landing page correctly redirects to an ES|QL Discover session when enabled.

closes #254912

🕵️‍♀️ Review notes

  • Added IS_ESQL_DEFAULT_FEATURE_FLAG_KEY constant to @kbn/discover-utils so it can be re-used in the logs locator.
  • Modified LogsLocatorDefinition to delegate to DISCOVER_APP_LOCATOR with an ES|QL query when the ES|QL feature flag is enabled and no query is provided; otherwise, it uses the default data view ID.
  • Added getDefaultEsqlQuery accessor to the observability root profile, which generates an ES|QL query based on the resolved logs index pattern, with fallback to previous values. Integrated this accessor into the profile provider.
  • For testing set feature_flags.overrides.discover.isEsqlDefault: true in the kibana config file.

@weltenwort weltenwort self-assigned this Mar 11, 2026
@weltenwort weltenwort added Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Project:OneDiscover Enrich Discover with contextual awareness Team:obs-exploration Observability Exploration team v9.4.0 labels Mar 11, 2026
@weltenwort
Copy link
Copy Markdown
Member Author

/oblt-deploy

@weltenwort weltenwort marked this pull request as ready for review March 13, 2026 18:38
@weltenwort weltenwort requested review from a team as code owners March 13, 2026 18:38
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-exploration-team (Team:obs-exploration)

Copy link
Copy Markdown
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@weltenwort weltenwort requested a review from a team as a code owner March 23, 2026 22:03
@weltenwort
Copy link
Copy Markdown
Member Author

I'm not convinced these failures are caused by the changes in this PR 🤔

cauemarcondes and others added 3 commits March 25, 2026 09:58
…fault ES|QL query change

The observability root profile now implements `getDefaultEsqlQuery`, returning
`FROM logs-*` as the initial ES|QL query when switching to text-based mode.
Before this change, the default resolved to `default-data-source-profile`
first (as an intermediate step), then transitioned to
`observability-logs-data-source-profile` when submitting a logs-based query.

After the change, switching to ES|QL mode already resolves directly to
`observability-logs-data-source-profile` (via `FROM logs-*`). When the user
then submits `from my-example-logs`, both queries resolve to the same profile,
so the EBT deduplication logic in `ScopedDiscoverEBTManager` suppresses the
duplicate event. This reduces the expected `discover_profile_resolved` event
count in the "different document profile" test from 3 → 2 (before opening the
doc viewer) and from 4 → 3 (after opening it).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cauemarcondes cauemarcondes enabled auto-merge (squash) March 25, 2026 20:05
@cauemarcondes cauemarcondes merged commit de4e3b8 into elastic:main Mar 26, 2026
19 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] affected Scout: [ platform / navigation ] plugin / local-serverless-security_complete - navigation - navigates to maintenance windows
  • [job] [logs] affected Scout: [ observability / apm ] plugin / local-stateful-classic - Service Overview - Transaction Details - OTEL service clicking waterfall accordion shows transaction details flyout

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 2012 2013 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/discover-utils 371 372 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 1.6MB 1.6MB +124.0B
logsShared 144.0KB 144.0KB -4.0B
total +120.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
logsShared 73.4KB 73.9KB +437.0B
Unknown metric groups

API count

id before after diff
@kbn/discover-utils 443 444 +1

History

cc @weltenwort

mbondyra added a commit to mbondyra/kibana that referenced this pull request Mar 26, 2026
…hanges

* commit '22bf09c82658b9511cbb2ad13f6dd29ad3526472': (21 commits)
  [Overlays System Flyout]: Support Child History (elastic#256339)
  KUA-Update event naming format and examples (elastic#259846)
  Fix pagerduty connector codeownership (elastic#259807)
  [Upgrade Assistant] Migrate Kibana deprecations flaky integration tests to unit tests (elastic#258981)
  [Upgrade Assistant] Migrate ES deprecations flaky integration tests to unit tests (elastic#258142)
  [Index Management] Migrate flaky integration tests to unit tests (elastic#258942)
  [Cases] Rename attachment id to saved object id (elastic#259158)
  [Entity Store] Change hash algo to sha256 (elastic#259453)
  [Security Solution] fixed enhanced security profile header showing for non-alert documents (elastic#259801)
  Update LaunchDarkly (main) (elastic#259008)
  [Discover] Add observability default ES|QL query (elastic#257268)
  Update dependency @redocly/cli to v2.21.1 (main) (elastic#259016)
  Gap reason detected (elastic#258231)
  [One Workflow] Historical executionContext and telemetry (elastic#258623)
  coderabbit: drop SigEvents (elastic#259863)
  [ci] Bump cypress disk (elastic#259861)
  Server timings (elastic#258915)
  Replace deprecated EUI icons in files owned by @elastic/kibana-cases (elastic#255633)
  [ci] Bump storybooks disk (elastic#259858)
  [drilldowns] require embeddables to opt into ON_OPEN_PANEL_MENU trigger (elastic#259637)
  ...
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Apr 1, 2026
## 📝 Summary

This implements the `getDefaultEsqlQuery` accessor for the observability
root profile. It also makes the logs locator from `logs_shared` aware of
the `discover.isEsqlDefault` feature flag so the observability landing
page correctly redirects to an ES|QL Discover session when enabled.

closes elastic#254912

## 🕵️‍♀️ Review notes

* Added `IS_ESQL_DEFAULT_FEATURE_FLAG_KEY` constant to
`@kbn/discover-utils` so it can be re-used in the logs locator.
* Modified `LogsLocatorDefinition` to delegate to `DISCOVER_APP_LOCATOR`
with an ES|QL query when the ES|QL feature flag is enabled and no query
is provided; otherwise, it uses the default data view ID.
* Added `getDefaultEsqlQuery` accessor to the observability root
profile, which generates an ES|QL query based on the resolved logs index
pattern, with fallback to previous values. Integrated this accessor into
the profile provider.
* For testing set `feature_flags.overrides.discover.isEsqlDefault: true`
in the kibana config file.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Cauê Marcondes <55978943+cauemarcondes@users.noreply.github.com>
Co-authored-by: Caue Marcondes <caue.marcondes@elastic.co>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
## 📝 Summary

This implements the `getDefaultEsqlQuery` accessor for the observability
root profile. It also makes the logs locator from `logs_shared` aware of
the `discover.isEsqlDefault` feature flag so the observability landing
page correctly redirects to an ES|QL Discover session when enabled.

closes elastic#254912

## 🕵️‍♀️ Review notes

* Added `IS_ESQL_DEFAULT_FEATURE_FLAG_KEY` constant to
`@kbn/discover-utils` so it can be re-used in the logs locator.
* Modified `LogsLocatorDefinition` to delegate to `DISCOVER_APP_LOCATOR`
with an ES|QL query when the ES|QL feature flag is enabled and no query
is provided; otherwise, it uses the default data view ID.
* Added `getDefaultEsqlQuery` accessor to the observability root
profile, which generates an ES|QL query based on the resolved logs index
pattern, with fallback to previous values. Integrated this accessor into
the profile provider.
* For testing set `feature_flags.overrides.discover.isEsqlDefault: true`
in the kibana config file.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Cauê Marcondes <55978943+cauemarcondes@users.noreply.github.com>
Co-authored-by: Caue Marcondes <caue.marcondes@elastic.co>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Discover Discover Application Project:OneDiscover Enrich Discover with contextual awareness release_note:skip Skip the PR/issue when compiling release notes Team:obs-exploration Observability Exploration team v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Define default Discover ES|QL query for observability projects

6 participants