Skip to content
Snippets Groups Projects
Commit 904a87c6 authored by Aivaras Gotovskis's avatar Aivaras Gotovskis
Browse files

Add or filter doc.

parent 863b4336
No related branches found
No related tags found
No related merge requests found
# Or Filter
> More info about or filter is in the [official elasticsearch docs][1]
A filter that matches documents using the OR boolean operator on other filters.
## Simple example
```JSON
{
"filtered" : {
"query" : {
"term" : { "name.first" : "shay" }
},
"filter" : {
"or" : [
{
"term" : { "name.second" : "banon" }
},
{
"term" : { "name.nick" : "kimchy" }
}
]
}
}
}
```
And now the query via DSL:
```php
$termFilter1 = new TermFilter('name.second', 'banon');
$termFilter2 = new TermFilter('name.nick', 'kimchy');
$orFilter = new OrFilter();
$orFilter->add($termFilter1);
$orFilter->add($termFilter2);
$termQuery = new TermQuery('name.first', 'shay');
$filteredQuery = new FilteredQuery($termQuery, $orFilter);
$search = new Search();
$search->addQuery($filteredQuery);
$queryArray = $search->toArray();
```
[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-or-filter.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