Match all query

Match all query #

Matches every document. This is the default query used when no query is sent in a search request — relevance-free, constant-scored, and the base every “everything, then narrow” pattern builds on.

How it works #

match_all walks every document in the target indexes with a constant score — 1.0 — so _score carries no ranking information and downstream score arithmetic (indices_boost, bool should boosts, cross-engine merges) sees the same baseline everywhere. boost multiplies the constant, and is the only parameter there is.

The producer is the cheapest in the engine: sequential document ids, no postings decode, no I/O. On the block path it enumerates the segment’s real document ids from the stored-docs table rather than a synthetic 0..n range, so segments with id holes (failed writes skip ids) never surface phantom documents. Every block carries the constant score, and downstream collectors skip score comparisons entirely.

Beyond the explicit query form it also serves as the engine’s internal “everything” base — the default query when a search body omits query, the base of a bool whose only clauses are must_not (everything minus the exclusions), and the collection query for aggregation-only requests.

Examples #

The query below returns everything — all 120 documents of the sales dataset. The SQL twin is a bare SELECT with no WHERE:

POST /my-collection/_search
{
  "query": {
    "match_all": {}
  }
}

Use cases #

  • Aggregation-only requests. "size": 0 plus aggs with no query: the whole index is the population, and match_all is what the engine runs under the hood.
  • Exclusion-only filters. A bool whose only clauses are must_not is “everything minus the exclusions” — match_all minus a set.
  • Totals and smoke tests. Full scans with track_total_hits are the baseline every other query’s hit count is checked against; the teaching datasets use it to pin totals (120 sales, 150 logs).
  • A score baseline. Constant 1.0 scores make boosting arithmetic visible: wrap match_all in a bool with should boosts and the output score is exactly the boost contribution.
  • Explicit “no query”. Writing match_all out documents intent — “filters and aggregations only” — and gives filters, post_filter and aggs a stated base instead of an implied one.

Parameters for match_all #

  • boost
    (Optional, float, default: 1.0) Applied to every matched document’s score.

Match none query #

The counterpart match_none matches no document at all — the empty side of the filter algebra. It is mostly a building block: tests use it as the always-false branch, and it is the neutral occupant wherever a query object is required but no matching is wanted:

POST /my-collection/_search
{
  "query": {
    "match_none": {}
  }
}
  • bool — match_all is the base under must_not-only bools and the neutral occupant of a scored clause.
  • match — the step up once actual relevance is needed.
  • match_none — the empty counterpart, on this page.
  • API conventions.
Calendar October 6, 2026
Edit Edit this page