Skip to content
Snippets Groups Projects
Commit d4fea5d3 authored by Simonas Šerlinskas's avatar Simonas Šerlinskas
Browse files

added boosting query docs

parent b6f4eba5
No related branches found
No related tags found
No related merge requests found
# 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment