Back to Kibana

Discover

src/platform/plugins/shared/discover/README.md

9.5.018.5 KB
Original Source

Discover

Contains the Discover application and the saved search embeddable.

Project tree

src/platform/plugins/shared/discover/public

Contains all the client-only code. When you initially load Discover, public/application/main is executed and displayed.

  • /application
    One folder for every "route", each folder contains files and folders related only to this route.
    • /context (Also known as "Surrounding documents" - historically this has been a separate plugin)
    • /doc (Also known as "Single document" - historically this has been a separate plugin)
    • /main (Main part of Discover containing the document table)
    • /not_found (Rendered when a route can't be found)
    • /view_alert (Forwarding links in alert notifications)
  • /components (All React components used in more than just one app)
  • /embeddable (Code related to the Discover session embeddable, rendered on dashboards)
  • /hooks (Code containing React hooks)
  • /services (Services either for external or internal use)
  • /utils (All utility functions used across more than one application)

src/platform/plugins/shared/discover/server

Contains all the server-only code.

  • /sample_data (Registrations with the Sample Data Registry for Discover saved objects)
  • /capabilities_provider (CapabilitiesProvider definition of capabilities for Core)
  • /ui_settings (Settings and the default values for UiSettingsServiceSetup )
  • /locator (Extensions of DiscoverAppLocator for the DiscoverServerPlugin API)

src/platform/plugins/shared/discover/common)

Contains all code shared by client and server.

  • /constants (General contants)
  • /field_types (Field types constants)
  • /locator (Registration with the URL service for BWC deep-linking to Discover views.)

Telemetry

Discover uses custom EBT events for product telemetry, standard performance_metric events for durations, and trackUiMetric UI counters for legacy usage counts. EBT registrations live in public/ebt_manager/discover_ebt_manager_registrations.ts.

All Discover EBT events can include the discover_context context provider. Its discoverProfiles field contains the active Discover context-awareness profile IDs.

Custom EBT Events

Each custom EBT event has an event type and a schema. The eventName field, when present, is the action name inside that event type.

discover_field_usage

Tracks field interactions in Discover, including table column selection/removal and filter creation.

Event nameDescription
dataTableSelectionA field was added to the Discover table.
dataTableRemovalA field was removed from the Discover table.
filterAdditionA filter was created from a field interaction.
FieldTypeDescription
eventNamekeywordField usage action.
fieldNamekeyword (optional)ECS field name when known, or <non-ecs> for non-ECS fields.
filterOperationkeyword (optional)Filter operation when eventName is filterAddition: +, -, or _exists_.

discover_query_fields_usage

Tracks field names extracted from submitted KQL and ES|QL queries.

Event nameDescription
kqlQueryA KQL query was analyzed for field usage.
esqlQueryAn ES|QL query was analyzed for field usage.
FieldTypeDescription
eventNamekeywordQuery language analyzed: kqlQuery or esqlQuery.
fieldNameskeyword[]Field names found in the query. ECS fields are recorded by name, non-ECS fields as <non-ecs>, and free-text KQL as __FREE_TEXT__.

discover_query_performance

Tracks timing and request-shape metadata when Discover completes a main fetch request or a fetch-more request. The same fetches are also reported as standard performance_metric events.

Event nameDescription
discoverFetchAllA main Discover fetch completed (table + chart).
discoverFetchAllRequestsOnlyA main Discover fetch completed (table only).
discoverFetchMoreA fetch-more request completed (table only).
FieldTypeDescription
eventNamekeywordQuery performance action.
durationintegerFetch duration in milliseconds.
queryRangeSecondslongAbsolute time range covered by the query, in seconds.
phraseQueryCountintegerNumber of phrase queries found in inspected Elasticsearch requests.
multiMatchTypeskeyword[]Multi-match query types found in inspected Elasticsearch requests.
fetchTypekeywordFetch implementation: fetchTextBased for ES|QL fetches, or fetchDocuments for classic mode fetches.
querySourceCommandkeyword (optional)ES|QL source command, such as FROM, TS, or PROMQL; omitted when unavailable.

discover_profile_resolved

Tracks context-awareness profile resolution at root, data source, or document level. Duplicate resolutions for the same level/profile are skipped.

Event nameDescription
NoneThis event type does not include eventName; contextLevel and profileId describe it.
FieldTypeDescription
contextLevelkeywordProfile resolution level, such as rootLevel, dataSourceLevel, or documentLevel.
profileIdkeywordResolved active profile ID.

discover_tabs

Tracks tab lifecycle and navigation interactions in Discover.

Event nameDescription
tabCreatedA new Discover tab was created.
tabClosedA Discover tab was closed.
tabSwitchedThe active Discover tab changed.
tabReorderedA Discover tab was moved to a new position.
tabDuplicatedA Discover tab was duplicated.
tabClosedOthersAll other Discover tabs were closed.
tabClosedToTheRightDiscover tabs to the right of the target tab were closed.
tabRenamedA Discover tab was renamed.
tabsLimitReachedThe maximum number of open Discover tabs was reached.
tabsKeyboardShortcutsUsedA keyboard shortcut was used for tab navigation.
tabsRestoredOnLoadDiscover tabs were restored when the app loaded.
tabSelectRecentlyClosedA recently closed Discover tab was selected.
FieldTypeDescription
eventNamekeywordTab action.
totalTabsOpeninteger (optional)Total number of open tabs at the time of the event.
remainingTabsCountinteger (optional)Number of tabs remaining after the event.
closedTabsCountinteger (optional)Number of tabs closed in a single action.
tabIdkeyword (optional)Unique identifier of the tab.
fromIndexinteger (optional)Original index of the tab being moved.
toIndexinteger (optional)New index of the tab being moved.
shortcutUsedkeyword (optional)Tab keyboard shortcut used: moveLeft, moveRight, moveHome, moveEnd, or closeTab.

discover_cascade

Tracks cascaded document expansion/collapse, opt-out, and open-in-new-tab actions.

Event nameDescription
cascaded_documents_expandedCascaded documents were expanded.
cascaded_documents_collapsedCascaded documents were collapsed.
cascaded_documents_opt_outThe user opted out of cascaded documents.
cascaded_documents_open_in_new_tab_clickedThe open-in-new-tab action was clicked for cascaded documents.
FieldTypeDescription
eventNamekeywordCascade action.
tabIdkeywordID of the tab where the cascade interaction occurred.
nodeIdkeyword (optional)ID of the cascaded document node, when applicable.

discover_in_dashboard

Tracks Discover session saves from a dashboard and tab switches inside embedded Discover panels.

Event nameDescription
savedSessionA Discover session was saved from a dashboard.
tabSwitchedThe active tab changed inside an embedded Discover panel.
FieldTypeDescription
eventNamekeywordDashboard embedding action.
dashboardIdkeyword (optional)Dashboard identifier.
embeddablePanelIdkeyword (optional)Embeddable panel instance identifier within the dashboard.
savedSessionIdkeyword (optional)Discover session identifier; present for savedSession events.
tabSwitchedFromIdkeyword (optional)Source tab identifier; present for tabSwitched events.
tabSwitchedToIdkeyword (optional)Destination tab identifier; present for tabSwitched events.

Standard Performance Metrics

These events are reported through reportPerformanceMetricEvent and use the shared performance_metric event type. Query performance fetches are also reported as the custom discover_query_performance EBT event described above.

Event nameDescription
discoverLoadSavedSearchA Discover tab finished loading.
discoverSurroundingDocsFetchA Surrounding documents fetch completed.
discoverFetchAllA main Discover fetch completed (table + chart).
discoverFetchAllRequestsOnlyA main Discover fetch completed (table only).
discoverFetchMoreA fetch-more request completed (table only).
FieldTypeDescription
eventNamekeywordPerformance metric action.
durationintegerEvent duration in milliseconds.
meta.fetchTypekeyword (optional)Fetch type. For discoverSurroundingDocsFetch: all, predecessors, successors, or context. For query performance events: fetchTextBased for ES|QL fetches, or fetchDocuments for classic mode fetches.
meta.multi_match_typeskeyword[] (optional)Multi-match query types found in inspected Elasticsearch requests for query performance events.
key1keyword (optional)Set to query_range_secs for query performance events.
value1long (optional)Absolute time range covered by the query, in seconds, when key1 is query_range_secs.
key2keyword (optional)Set to phrase_query_count for query performance events.
value2integer (optional)Number of phrase queries found in inspected Elasticsearch requests when key2 is phrase_query_count.

UI Counters

These counters are reported with usageCollection.reportUiCounter('discover', ...) through trackUiMetric.

Metric typeEvent nameDescription
clickfield_statistics_view_clickThe user switched to the field statistics view.
clickpattern_analysis_view_clickThe user switched to the pattern analysis view.
clickdocuments_view_clickThe user switched to the documents view.
clickesql:try_btn_clickedThe user switched from data view mode to ES|QL mode.
clickesql:back_to_classic_clickedThe user switched from ES|QL mode back to data view mode.
clickesql_filter_addedA filter was added while in ES|QL mode.
clickfilter_addedA filter was added while in data view mode.
loadedfield_statistics_loadedThe field statistics table loaded.
loadedpattern_analysis_loadedThe pattern analysis table loaded.
countad_hoc_data_viewDiscover rendered with an ad hoc data view.

Feature flags

See the Feature flag service documentation for details on how to use feature flags.

Set constants for feature flag keys in public/constants.ts.

These are the feature flags used by Discover: