Migrate tag option filtering from slicing to MoreSearchAdapter - #26841
Open
danotorrey wants to merge 3 commits into
Open
Migrate tag option filtering from slicing to MoreSearchAdapter#26841danotorrey wants to merge 3 commits into
danotorrey wants to merge 3 commits into
Conversation
The tags filter dropdown fetched its values via /events/slices, which goes through the views search engine and requires streams:read on the events stream, returning a 403 for users who can only read the events' source streams. The new endpoint aggregates distinct tag values directly via MoreSearch, scoped to the caller's readable source streams. The dropdown's typed text is forwarded as field_query and applied as a terms-aggregation include pattern (case-insensitive contains), with the response capped at the 50 most-used values. Fixes Graylog2/graylog-plugin-enterprise#14282 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
danotorrey
marked this pull request as ready for review
July 31, 2026 20:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously, the Tags filter on the Alerts page loaded its values through
POST /events/slices, which executes through the views search engine.SearchExecutionGuardthere requiresstreams:readon the events stream itself, so users whose permissions only cover the events' source streams got a 403 and a broken filter.This adds
POST /events/filter_options, which aggregates distinct tag values directly throughMoreSearch— the same source-stream-scoped aggregation path already used in production elsewhere — so visibility is determined by the source streams of the events alone.The endpoint supports server-side search: the dropdown forwards the typed text as
field_query, applied as anincludepattern on the terms aggregation (case-insensitive contains; tags are lowercase-normalized at write time). The response returns the 50 most-used values; searching reaches values past the cap, and there's intentionally no truncation indicator in the response./events/slicesis unchanged, and existing callers ofMoreSearch.aggregateSlicesForColumnkeep their signature via a delegating overload, so no enterprise changes are needed.Notes
/events/slicespath. Integration tests for the aggregation run against real OpenSearch 2, OpenSearch 3, and Elasticsearch 7 containers.Fixes Graylog2/graylog-plugin-enterprise#14282
Assisted with Claude Code