Skip to content

ES|QL: Adding USER_AGENT command#144384

Merged
eyalkoren merged 49 commits intoelastic:mainfrom
eyalkoren:esql-user_agent-command
Mar 31, 2026
Merged

ES|QL: Adding USER_AGENT command#144384
eyalkoren merged 49 commits intoelastic:mainfrom
eyalkoren:esql-user_agent-command

Conversation

@eyalkoren
Copy link
Copy Markdown
Contributor

@eyalkoren eyalkoren commented Mar 17, 2026

Closes #134886

Relies on the infrastructure that was introduced in #140712

Notes for reviewer

Column pruning via properties and extract_device_type at logical-plan creation

The properties and extract_device_type config options are resolved into the concrete set of output field names at the coordinator, inside LogicalPlanBuilder.visitUserAgentCommand(), before the logical plan node is even created. The UserAgent logical plan node receives only the already-filtered outputFieldNames — it has no awareness of properties at all. This means unrequested columns are never created, never serialized, and never allocated on data nodes.

Details object allocation per row is acceptable

Unlike URI_PARTS and REGISTERED_DOMAIN, where the bridge's evaluate() can write primitive values directly from the parsed result without intermediate allocations, the UserAgentParser.parseUserAgentInfo() API always returns a Details record (which itself contains VersionedName records for OS and device).

This does NOT represent a per-row allocation concern because results are served from a cache:

  • Cache hit path: The UserAgentParser implementation maintains an internal LRU cache keyed by user-agent string. On cache hit, the previously allocated Details object is returned directly — no new allocation.
  • Cache miss path: A full regex-based parse is required, which is itself a heavy operation involving multiple regex compilations and matches. The Details and VersionedName allocations are negligible compared to the regex parsing cost, and they must exist anyway because the result needs to be cached for future lookups.

@eyalkoren eyalkoren self-assigned this Mar 17, 2026
@elasticsearchmachine elasticsearchmachine added the external-contributor Pull request authored by a developer outside the Elasticsearch team label Mar 17, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @eyalkoren, I've created a changelog YAML for you.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 17, 2026

🔍 Preview links for changed docs

@github-actions
Copy link
Copy Markdown
Contributor

ℹ️ Important: Docs version tagging

👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version.

We use applies_to tags to mark version-specific features and changes.

Expand for a quick overview

When to use applies_to tags:

✅ At the page level to indicate which products/deployments the content applies to (mandatory)
✅ When features change state (e.g. preview, ga) in a specific version
✅ When availability differs across deployments and environments

What NOT to do:

❌ Don't remove or replace information that applies to an older version
❌ Don't add new information that applies to a specific version without an applies_to tag
❌ Don't forget that applies_to tags can be used at the page, section, and inline level

🤔 Need help?

@eyalkoren eyalkoren changed the title Esql user agent command ES|QL: Adding USER_AGENT command Mar 17, 2026
@ivancea ivancea requested a review from ncordon March 18, 2026 16:52
@eyalkoren eyalkoren requested review from leemthompo and ncordon March 29, 2026 12:39
Copy link
Copy Markdown
Member

@leemthompo leemthompo left a comment

Choose a reason for hiding this comment

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

Docs LGTM 👍

Copy link
Copy Markdown
Member

@ncordon ncordon left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my comments 🤗

@eyalkoren eyalkoren enabled auto-merge (squash) March 30, 2026 10:04
@eyalkoren eyalkoren disabled auto-merge March 30, 2026 13:25
@eyalkoren eyalkoren enabled auto-merge (squash) March 30, 2026 13:25
@eyalkoren eyalkoren disabled auto-merge March 31, 2026 07:35
@eyalkoren eyalkoren merged commit 93c7715 into elastic:main Mar 31, 2026
31 checks passed
pmpailis pushed a commit that referenced this pull request Mar 31, 2026
@eyalkoren eyalkoren deleted the esql-user_agent-command branch March 31, 2026 11:17
szybia added a commit to szybia/elasticsearch that referenced this pull request Mar 31, 2026
…rics

* upstream/main: (428 commits)
  ESQL: DS: Add inference/RERANK tests (elastic#145229)
  Unmute MMR logical plan test (elastic#145311)
  Do not attempt marking store as corrupted if the check is rejected due to shutdown (elastic#145209)
  feat(tsdb): add pipeline runtime and rename stage interfaces (elastic#145175)
  Fix UnresolvedException on PromQL by(step) grouping (elastic#145307)
  ES|QL: Optimize MMR by reducing cache size and lookup (elastic#145014)
  Prometheus labels/series APIs: support multiple match[] selectors (elastic#145298)
  Move ClientScrollablePaginatedHitSource into Reindex Module (elastic#144100)
  mute test class for elastic#145277
  CPS mode for ViewResolver (elastic#145219)
  [ESQL] Disables GroupedTopNBenchmark temporarily (elastic#145124)
  Make exponential_histogram the default histogram type for HTTP OTLP endpoint (elastic#145065)
  More tests requiring an explicit confidence interval (elastic#145232)
  ES|QL: Adding `USER_AGENT` command (elastic#144384)
  ESQL: enable Generative IT after more fixes (elastic#145112)
  Rework FieldMapper parameter tests to not use merge builders (elastic#145213)
  [ESQL] Fix ORC type support gaps (elastic#145074)
  [Test] Unmute FollowingEngineTests.testProcessOnceOnPrimary (elastic#145192)
  Add PrometheusSeriesRestAction for /_prometheus/api/v1/series endpoint (elastic#144494)
  Prometheus labels API: add rest action (elastic#144952)
  ...
ncordon added a commit to ncordon/elasticsearch that referenced this pull request Apr 1, 2026
@idegtiarenko idegtiarenko mentioned this pull request Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL external-contributor Pull request authored by a developer outside the Elasticsearch team >feature serverless-linked Added by automation, don't add manually Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESQL: Support user_agent command

5 participants