| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | [[query-dsl-dis-max-query]]=== Disjunction max query++++<titleabbrev>Disjunction max</titleabbrev>++++Returns documents matching one or more wrapped queries, called query clauses orclauses.If a returned document matches multiple query clauses, the `dis_max` queryassigns the document the highest relevance score from any matching clause, plusa tie breaking increment for any additional matching subqueries.You can use the `dis_max` to search for a term in fields mapped with different<<mapping-boost,boost>> factors.[[query-dsl-dis-max-query-ex-request]]==== Example request[source,js]----GET /_search{    "query": {        "dis_max" : {            "queries" : [                { "term" : { "title" : "Quick pets" }},                { "term" : { "body" : "Quick pets" }}            ],            "tie_breaker" : 0.7        }    }}    ----// CONSOLE[[query-dsl-dis-max-query-top-level-params]]==== Top-level parameters for `dis_max``queries`::(Required, array of query objects) Contains one or more query clauses. Returneddocuments **must match one or more** of these queries. If a document matchesmultiple queries, {es} uses the highest <<query-filter-context, relevancescore>>.`tie_breaker`::+--(Optional, float) Floating point number between `0` and `1.0` used to increasethe <<relevance-scores,relevance scores>> of documents matching multiplequery clauses. Defaults to `0.0`.You can use the `tie_breaker` value to assign higher relevance scores todocuments that contain the same term in multiple fields than documents thatcontain this term in only the best of those multiple fields, without confusingthis with the better case of two different terms in the multiple fields.If a document matches multiple clauses, the `dis_max` query calculates therelevance score for the document as follows:. Take the relevance score from a matching clause with the highest score.. Multiply the score from any other matching clauses by the `tie_breaker` value.. Add the highest score to the multiplied scores.If the `tie_breaker` value is greater than `0.0`, all matching clauses count,but the clause with the highest score counts most.--
 |