Fix filter clicks on array-valued JSON fields#182
Merged
Sh4d1 merged 5 commits intoquickwit-oss:mainfrom Apr 28, 2026
Merged
Conversation
Documents how the = operator wraps array values like ["paperclip"] in quotes, producing phrase queries that don't match indexed array elements. Tests cover all operator types and edge cases. Refs quickwit-oss#179
When Grafana passes a stringified array like ["paperclip"] as a filter value, detect it as JSON array and generate term queries on the individual elements instead of a phrase query on the literal string. Single element: attributes.tags:paperclip Multiple elements: attributes.tags:paperclip OR attributes.tags:stapler Empty array: no-op Fixes quickwit-oss#179
Single-element arrays still produce a simple term query. Multi-element arrays now produce field:IN ["a" "b"] which maps to tantivy's TermSetQuery — cleaner than chaining OR clauses. Refs quickwit-oss#179
Tantivy indexes array elements as individual terms with no way to match on array structure. Document why IN (match any) is used for multi-element arrays.
Sh4d1
reviewed
Apr 26, 2026
Values like ["foo bar"] or ["foo:bar"] produced broken queries (e.g. field:foo bar) because the single-element path emitted bare terms. Now all array element values are quoted as phrase queries, consistent with the multi-element IN path.
Contributor
Author
|
@Sh4d1 ready for another review |
Collaborator
|
Thanks @xrl ! |
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.
Summary
["paperclip"]) as a filter value, the=operator wrapped it in quotes producingattributes.tags:"[\"paperclip\"]"— a phrase query matching no documentsattributes.tags:paperclipattributes.tags:IN ["paperclip" "stapler"](tantivy TermSetQuery)[that aren't valid JSON pass through unchangedNote: tantivy indexes array elements as individual terms — there's no way to match on array length, order, or exact composition. For multi-element arrays we use IN (match any), which is the most useful behavior for log exploration filters.
Test plan
Fixes #179