From 7094705a4cf0308d8f998d889273ba7ab6b41947 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Tue, 7 Jul 2015 11:55:47 +0300 Subject: [PATCH] Add exists filter doc. --- docs/Filter/Exists.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 docs/Filter/Exists.md diff --git a/docs/Filter/Exists.md b/docs/Filter/Exists.md new file mode 100644 index 0000000..c54434e --- /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 -- GitLab