Skip to content

Avoid sending all term filters to the tag filter#53

Merged
rdettai-sk merged 2 commits into
sekoiafrom
avoid-sending-tags-to-metastore
Jun 4, 2026
Merged

Avoid sending all term filters to the tag filter#53
rdettai-sk merged 2 commits into
sekoiafrom
avoid-sending-tags-to-metastore

Conversation

@rdettai-sk
Copy link
Copy Markdown
Collaborator

Description

We have observed serious degradations of the metastore performances (even OOMs) due to large TermSet queries (10k+ terms) that send huge tag filter ASTs to Postgres. This PR changes the behavior to only send the terms filters when the target index actually has tag fields, and if so only send the relevant filters.

How was this PR tested?

Added unit tests but mostly trust the CI.

@rdettai-sk rdettai-sk changed the base branch from main to sekoia June 4, 2026 13:00
@rdettai-sk rdettai-sk requested a review from Copilot June 4, 2026 13:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces metastore load caused by very large tag-filter ASTs (notably from large TermSet queries) by restricting extracted tag filters to the tag fields actually present in the targeted indexes, instead of extracting all term filters indiscriminately.

Changes:

  • Extend extract_tags_from_query to accept an optional set of tag field names and prune irrelevant tag filters early in the tag-filter AST.
  • In root search planning, compute tag fields from the resolved index metadata and extract only relevant tag filters before listing splits.
  • Update janitor and search tests to use the new extract_tags_from_query signature and cover cases with/without tag fields.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
quickwit/quickwit-search/src/tests.rs Updates split-pruning tests to validate behavior when tag fields exist vs. when tag extraction is disabled via an empty tag-field set.
quickwit/quickwit-search/src/root.rs Restricts tag-filter extraction to tag fields present in the targeted indexes before querying the metastore for relevant splits.
quickwit/quickwit-janitor/src/actors/delete_task_planner.rs Adapts to the new extract_tags_from_query API while preserving prior behavior (extract all).
quickwit/quickwit-doc-mapper/src/tag_pruning.rs Adds tag-field-aware pruning of the unsimplified tag-filter AST and expands unit test coverage for filtered extraction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread quickwit/quickwit-doc-mapper/src/tag_pruning.rs
Comment thread quickwit/quickwit-doc-mapper/src/tag_pruning.rs Outdated
Comment thread quickwit/quickwit-search/src/root.rs
@rdettai-sk rdettai-sk force-pushed the avoid-sending-tags-to-metastore branch from 09c9c68 to 44fc93b Compare June 4, 2026 13:11
@rdettai-sk rdettai-sk requested a review from Darkheir June 4, 2026 13:17
@rdettai-sk rdettai-sk force-pushed the avoid-sending-tags-to-metastore branch from 44fc93b to 6b55609 Compare June 4, 2026 13:20
@rdettai-sk rdettai-sk merged commit 89ab1a5 into sekoia Jun 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants