Skip to content

ES|QL: Validate TOP_SNIPPETS query argument is foldable#142763

Draft
mridula-s109 wants to merge 5 commits intoelastic:mainfrom
mridula-s109:topsnippet/foldable
Draft

ES|QL: Validate TOP_SNIPPETS query argument is foldable#142763
mridula-s109 wants to merge 5 commits intoelastic:mainfrom
mridula-s109:topsnippet/foldable

Conversation

@mridula-s109
Copy link
Contributor

Implements compile-time validation for the TOP_SNIPPETS function to ensure that its query parameter is foldable (constant). This follows the same pattern as other full-text functions like Match.

Changes:

  • TopSnippets.java: Implements PostOptimizationVerificationAware interface and adds postOptimizationVerification() method using Foldables.resolveTypeQuery()
  • TopSnippetsValidationTests.java: New unit tests for validation logic
  • TopSnippetsTests.java: Updated assertion style per code review feedback
  • LogicalPlanOptimizerTests.java: Added post-optimization validation tests
  • top-snippets.csv-spec: Added integration tests for foldable query validation
  • docs/changelog/142462.yaml: Added changelog entry

Fixes #142462

…on time

Implements compile-time validation for the TOP_SNIPPETS function to ensure
that its query parameter is foldable (constant). This follows the same
pattern as other full-text functions like Match.

Changes:
- TopSnippets.java: Implements PostOptimizationVerificationAware interface
  and adds postOptimizationVerification() method using Foldables.resolveTypeQuery()
- TopSnippetsValidationTests.java: New unit tests for validation logic
- TopSnippetsTests.java: Updated assertion style per code review feedback
- LogicalPlanOptimizerTests.java: Added post-optimization validation tests
- top-snippets.csv-spec: Added integration tests for foldable query validation
- docs/changelog/142462.yaml: Added changelog entry

Fixes elastic#142462
@mridula-s109 mridula-s109 self-assigned this Feb 20, 2026
@mridula-s109 mridula-s109 added >enhancement Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch :Search Relevance/ES|QL Search functionality in ES|QL v9.4.0 labels Feb 20, 2026
@elasticsearchmachine
Copy link
Collaborator

Hi @mridula-s109, I've created a changelog YAML for you.

@mridula-s109 mridula-s109 changed the title ES|QL: Validate TOP_SNIPPETS query argument is foldable at verification ES|QL: Validate TOP_SNIPPETS query argument is foldable Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search Relevance/ES|QL Search functionality in ES|QL Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ES|QL TOP_SNIPPETS: Validate query argument is foldable at verification time

2 participants

Comments