Intervals and more-like-this queries #
Two Elasticsearch-compatible queries landed natively in the engine —
no more shape-shifting through match_phrase compositions.
intervals is a rule language over term positions. Say “these two
phrases within two positions of each other, but only if neither
overlaps this third one”:
POST /my-collection/_search
{
"query": {
"intervals": {
"body": {
"all_of": {
"ordered": true,
"intervals": [
{ "match": { "query": "search engine", "max_gaps": 0, "ordered": true } },
{ "match": { "query": "ranking", "max_gaps": 2 } }
],
"filter": { "not_overlapping": { "match": { "query": "deprecated" } } }
}
}
}
}
}
Eight rule shapes (match, all_of, any_of, prefix, wildcard,
fuzzy, regexp, range) and eight positional filter predicates
(containing, before, not_overlapping, …) compose into one tree.
Unsupported knobs are rejected with named errors instead of silently
ignored — ask for a script filter and you will be told no.
more_like_this is the classic similarity query: give it text or
documents and it expands the significant terms into a disjunctive
query — “find more of this” without an embedding model:
POST /my-collection/_search
{
"query": {
"more_like_this": {
"fields": ["title", "body"],
"like": [{ "_id": "42" }],
"unlike": "clearance sale",
"min_term_freq": 1
}
}
}
Liked documents are excluded from their own results by default
(include: false), minimum_should_match defaults to "30%"
with the same truncating resolution, and unlike drops the terms the
result should steer away from.
Both queries execute across every segment kind — frozen blocks, realtime mutable segments, and legacy immutable segments — with one shared interval evaluator, and participate in BM25 scoring, count pushdown, and highlighting like any native query.