01 · DATA MODEL

Query types

Every supported query is a variant of a single QueryNode enum. They all compile to the same execution plan, so mixing and matching them under a bool wrapper is free — there's no orchestrator round trip.

The list below is the complete set of keys the parser dispatches, generated from xerj_query::parser::SUPPORTED_QUERY_TYPES and held to it by a test. Being listed means the query parses, plans and runs — it is not a promise that every ES parameter is honoured; per-type gaps live in ROADMAP.md.

Structural

match_allEverything in the index.
match_noneNothing. Useful inside bool branches.
boolmust · should · must_not · filter
constant_scoreWrap a filter with a fixed score.
dis_maxMax-score across disjuncts.
boostingPositive branch, demoted negative branch.
typeLegacy mapping-types key. Every document is _doc, so it degrades to match_all.

Term-level

termExact-value keyword match.
termsOR of many term values.
terms_setterms with a per-query minimum_should_match.
rangeNumeric / date range filter.
prefixKeyword prefix match.
wildcardGlob-style keyword match.
regexpRegular expression term match.
fuzzyEdit-distance match.
existsField has a non-null value.
idsFetch docs by id.

Full-text

matchAnalyzed full-text query.
match_phrasePhrase with positional match.
match_phrase_prefixPhrase + prefix on last term.
match_bool_prefixLast token becomes a prefix query, the rest terms, under a bool should.
multi_matchMatch across multiple fields.
combined_fieldsApproximated by multi_match cross_fields — no ES term-statistic pooling.
query_stringLucene-style mini-DSL.
simple_query_stringSafe subset for end-user input.
intervalsRule tree (match / prefix / wildcard / all_of / any_of) lowered onto the standard queries; gap bounds are not modelled.

Span

span_termPositional anchor for span queries.
span_nearTerms within N positions.
span_orUnion of span queries.
span_notExclusion within span windows.
span_firstAnchor near the start of a field.
span_containingBig span that contains a little span.
span_withinLittle span contained by a big span.

AI-native

knnVector kNN — HNSW-served when unfiltered (exact-rescored); filtered runs the exact scan.
semanticEmbed the query text at query time and search the vector field.
hybridRRF / linear fusion of queries.

Geo

geo_distanceDistance-from-point filter.
geo_bounding_boxBounding-box filter.
geo_polygonPoint-in-polygon filter.
geo_shapeEnvelope / shape relation filter.

Scoring & scripting

function_scoreRewrite scores with functions.
script_scoreA Painless script replaces the BM25 score.
scriptPainless predicate used as a filter.
rank_featurelog1p boost on a numeric feature field, via function_score.
distance_featureProximity boost lowered onto function_score field_value_factor; ES's exact decay curve is not reproduced.
pinnedBoost specific docs to the top.

Specialized

nestedInner query evaluated per element of a nested field. score_mode and inner_hits are not honoured.
more_like_thisFind similar docs by text fingerprint.
percolateStored queries matched against an inline document; the index/id fetch form is rejected with a 400.
wrapperbase64-encoded query JSON.

Recognised and rejected

These two keys are recognised so that sending them fails with a specific 400 instead of the generic unknown-query-type error. XERJ never materialises a parent/child join, so a query that ran would return unfiltered hits — denormalize the relationship instead.

has_child400 at parse time. No parent/child join exists.
has_parent400 at parse time. No parent/child join exists.

Source · engine/crates/xerj-query/src/parser.rs · SUPPORTED_QUERY_TYPES / REJECTED_QUERY_TYPES