quickwit-oss / quickwit-oss/quickwit

Leading-`-` / bool.must_not matches documents where the field is absent

Open
#6,474 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
11.7k
Forks
597
Avg merge
2d 22h
Merged PRs (30d)
37

Description

Summary

Quickwit's leading-- operator (and bool.must_not) matches every document where the inner clause evaluates false, including documents that don't contain the field at all. This differs from both SQL WHERE NOT x = 'foo' (which excludes NULLs) and Elasticsearch must_not (which excludes missing-field docs).

Repro

Index two docs: {"vendor": "aws"} and {} (no vendor field).

curl -sS "$QW/api/v1/<index>/search?query=-vendor:aws"
# → returns BOTH docs.
# Elasticsearch must_not on the same data returns only the {} doc.
# SQL `WHERE vendor <> 'aws'` returns NEITHER (NULLs excluded).

Expected behavior

Either align - / must_not with SQL+ES semantics (field != value AND field exists), or expose a separate operator with that semantic (field:!value, must_not_exists, etc.) and document the distinction.

Why this matters

Every "does not equal" predicate in a user-facing query layer has to be wrapped in an explicit existence guard (field:[* TO *] AND -field:value) to get expected behavior. The existence guard itself is fragile because the right "exists" syntax varies by field type (see related: field:* silently zero when index_field_presence: false).

Version

Observed on 0.8.x.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files or tests are named. Start by tracing the query parser and evaluator paths for leading - and bool.must_not, then reproduce the two-document case; done means the chosen missing-field semantics are covered by a regression test and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.