From 40e1af5702d89e7228a56a4afe8e48f60b5b6062 Mon Sep 17 00:00:00 2001
From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io>
Date: Wed, 1 Jul 2015 11:13:04 +0300
Subject: [PATCH] Add dis max query doc.

---
 docs/Query/DisMax.md | 45 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 docs/Query/DisMax.md

diff --git a/docs/Query/DisMax.md b/docs/Query/DisMax.md
new file mode 100644
index 0000000..af4fee5
--- /dev/null
+++ b/docs/Query/DisMax.md
@@ -0,0 +1,45 @@
+# Dis Max query
+
+> More info about Dis Max query is in the [official elasticsearch docs][1]
+
+A query that generates the union of documents produced by its subqueries, and that scores each document with the
+maximum score for that document as produced by any subquery, plus a tie breaking increment for any additional matching
+subqueries.
+
+Lets try to write this example
+```JSON
+{
+    "dis_max" : {
+        "tie_breaker" : 0.7,
+        "boost" : 1.2,
+        "queries" : [
+            {
+                "term" : { "age" : 34 }
+            },
+            {
+                "term" : { "age" : 35 }
+            }
+        ]
+    }
+}
+```
+
+In DSL :
+
+```php
+$term1 = new TermQuery('age', 34);
+$term2 = new TermQuery('age', 35);
+
+$disMax = new DisMaxQuery();
+$disMax->addParameter('tie_breaker', 0.7);
+$disMax->addParameter('boost', 1.2);
+$disMax->addQuery($term1);
+$disMax->addQuery($term2);
+
+$search = new Search();
+$search->addQuery($disMax);
+
+$queryArray = $search->toArray();
+```
+
+[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-dis-max-query.html
-- 
GitLab