diff --git a/docs/Filter/Exists.md b/docs/Filter/Exists.md new file mode 100644 index 0000000000000000000000000000000000000000..c54434e3994e396e84ed630a481b1410f371587c --- /dev/null +++ b/docs/Filter/Exists.md @@ -0,0 +1,31 @@ +# Exists Filter + +> More info about exists filter is in the [official elasticsearch docs][1] + +Returns documents that have at least one non-null value in the original field. + +## Simple example + +```JSON +{ + "constant_score" : { + "filter" : { + "exists" : { "field" : "user" } + } + } +} +``` + +And now the query via DSL: + +```php +$existsFilter = new ExistsFilter('user'); +$constantScoreQuery = new ConstantScoreQuery($existsFilter); + +$search = new Search(); +$search->addQuery($constantScoreQuery); + +$queryArray = $search->toArray(); +``` + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-filter.html