More like this query
/ More_like_this, / Similarity, / QueryMore like this query #
more_like_this finds documents similar to given text or documents.
The engine extracts the input’s terms, keeps the significant ones, and
runs the resulting top terms as a disjunctive query — a “find more of
this” query without any embedding model.
fields is required and limited to text fields.
How it works #
The query is rewritten at the search entry point — it is a client of
the analysis and term pipeline, not an index structure. Per field:
gather the like text (free text is
analyzed with the first field’s analyzer; a referenced document
contributes the text of every query field), tokenize it, drop terms
below min_term_freq, outside the word-length bounds, or listed in
stop_words, and remove every term the unlike inputs produced.
The surviving terms from all fields are pooled, ranked by source term
frequency (ties broken alphabetically for determinism), and the top
max_query_terms become a bool.should of term queries governed
by minimum_should_match. If nothing survives, the query matches
nothing. When include is false (the default) and the like input
named documents, their ids are added as a must_not — the seed
documents trivially contain every selected term.