Skip to content
Snippets Groups Projects
Commit 878143e3 authored by Mantas Simkus's avatar Mantas Simkus
Browse files

edited FiltersAggregation docs

parent d6a928e2
No related branches found
No related tags found
No related merge requests found
......@@ -14,15 +14,15 @@ in exception.
```JSON
{
"aggregations" : {
"agg_messages" : {
"grades_stats" : {
"filters" : {
"filters" : {
"errors" : { "term" : { "body" : "error" }},
"warnings" : { "term" : { "body" : "warning" }}
"error" : { "term" : { "body" : "error" }},
"warning" : { "term" : { "body" : "warning" }}
}
},
"aggregations" : {
"agg_monthly" : {
"monthly" : {
"histogram" : {
"field" : "timestamp",
"interval" : "1M"
......@@ -60,6 +60,31 @@ $queryArray = $search->toArray();
## Anonymous example
```JSON
{
"aggregations" : {
"grades_stats" : {
"filters" : {
"filters" : [
{ "term" : { "body" : "error" }},
{ "term" : { "body" : "warning" }}
]
}
},
"aggregations" : {
"monthly" : {
"histogram" : {
"field" : "timestamp",
"interval" : "1M"
}
}
}
}
}
}
```
And now the query via DSL:
```php
$errorTermFilter = new TermFilter('body', 'error');
$warningTermFilter = new TermFilter('body', 'warning');
......@@ -83,4 +108,4 @@ $search->addAggregation($filterAggregation);
$queryArray = $search->toArray();
```
[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filters-aggregation.html
\ No newline at end of file
[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filters-aggregation.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