← Back to Pull requests

ESQL: Add the param_any_value query setting #166823

Open
unknown opened this pull request with 447 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 20, 2026 10:41 UTC
Author

Stack: [#166823] - #166824 - #166825 - #166826 - #166827

The whole stack

This is part 1 of 5 of the ES|QL "Any" controls (Phase 1, see #136735). Each PR is based on the previous one and has its own tests, so it can be reviewed separately.

An "Any" value lets a client send one query for every filter state: a query parameter holding a reserved value ("__ANY__" by default, set by the param_any_value query setting) stands for "no filter on this", so the conditions that use it match everything.

1. #166823 (this PR): the param_any_value setting. No query changes.
2. #166824: the parameter holding the value is recognized, and rejected with a clear error wherever it is used.
3. #166825: an unnamed STATS ... BY ??g key holding the value is dropped.
4. #166826: the supported conditions that compare with the parameter are replaced with true where they are the filter of a WHERE.
5. #166827: "Any" errors no longer hide other errors. It also adds the changelog of the whole stack.

Everything is snapshot-only for now (GA in a later PR, once Kibana has tested it), so release builds are not affected.

Known edge cases (not handled yet)

  • Default value: the default "__ANY__" can collide with a real value (WHERE category == ?c with a stored "__ANY__" can't be searched). To be decided before un-snapshotting: keep it, or default to null and let Kibana send it in the request.

  • SET values (limitation): a parameter used as the value of a SET is never taken for "Any". SET unmapped_fields = ?x with ?x holding the reserved value is a plain string, and fails the usual validation of that setting instead of the "Any" error. This keeps the result independent of the order of the SETs, and lets SET param_any_value = ?v work. No current setting can take "Any" as a value; revisit this if one does.

  • SET in subqueries and views: the grammar has no SET inside a subquery, and views can't take parameters, so they are parsed without a reserved value. If any of them is added, decide then which param_any_value applies and to what (tests: testSetInASubqueryIsRejected, testViewDefinitionCannotHaveParameters, testViewDoesNotRecognizeTheReservedValue).

  • Pruned cross-cluster branch: FROM test, (FROM remote:missingIndex | WHERE emp_no > ?x) with ?x holding the value should fail like FROM test | WHERE emp_no > ?x, but the branch is pruned before verification, so it returns the local rows.
  • This PR

    This first step only adds the setting, and changes no query.

  • param_any_value query setting (string, default "__ANY__", snapshot-only, no cluster default yet), resolved from the request or SET param_any_value = "...", in QuerySettings.

  • The value is resolved before parsing and passed to the parser in ParsingContext, because the parser decides while it reads the query whether a parameter is "Any" (the following PRs), and the rest of the settings are only resolved after parsing. SET statements of the query update it as they come, in a per-parse field of the builder (not in the shared QueryParams). On release builds it is null, so the default is never live there.

  • Capability param_any_value (snapshot-only): the single switch of the whole stack. The parser and the tests of the feature check it with isEnabled(), so it is the one place to review when the feature is un-snapshotted.

  • Tests: setting precedence, duplicate SET, wrong type, empty value, SET param_any_value = ?v (accepted, as a plain value), release-build rejection, ConfigurationSerializationTests.
  • Diff: 447 lines (+335 / -112) across 5 files Reviewer: kosabogi Review duration: 16588m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 447 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.365
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #166823"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.4% (MEDIUM) · Higher = larger blast radius
    45.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.2% · Safe to merge
    24.2%