From d4fea5d32d5b9b8db9354f58ecfc6f97dc0bf2b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simonas=20=C5=A0erlinskas?= <simonas.serlinskas@nfq.com> Date: Wed, 1 Jul 2015 08:55:40 +0300 Subject: [PATCH] added boosting query docs --- docs/Query/Boosting.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 docs/Query/Boosting.md diff --git a/docs/Query/Boosting.md b/docs/Query/Boosting.md new file mode 100644 index 0000000..497a3de --- /dev/null +++ b/docs/Query/Boosting.md @@ -0,0 +1,40 @@ +# Boosting query + +> More info about Boosting query is in the [official elasticsearch docs][1] + +Lets take an example to write a query with Elasticsearch DSL. + +```JSON +{ + "boosting" : { + "positive" : { + "term" : { + "field1" : "value1" + } + }, + "negative" : { + "term" : { + "field2" : "value2" + } + }, + "negative_boost" : 0.2 + } +} +``` + +And now the query via DSL: + +```php +$termQuery1 = new TermQuery("field1", "value1"); +$termQuery2 = new TermQuery("field2", "value2"); + +$boostingQuery = new BoostingQuery($termQuery1, $termQuery2, 0.2); + +$search = new Search(); +$search->addQuery($boostingQuery); + +$queryArray = $search->toArray(); +``` + + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-boosting-query.html -- GitLab