From 9a0473cdd65337fef8c2d3995dab959f53d0ac2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simonas=20=C5=A0erlinskas?= <simonas.serlinskas@nfq.com> Date: Wed, 1 Jul 2015 08:55:55 +0300 Subject: [PATCH] added common terms docs --- docs/Query/CommonTerms.md | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 docs/Query/CommonTerms.md diff --git a/docs/Query/CommonTerms.md b/docs/Query/CommonTerms.md new file mode 100644 index 0000000..a2307a3 --- /dev/null +++ b/docs/Query/CommonTerms.md @@ -0,0 +1,46 @@ +# Common terms query + +> More info about Common terms query is in the [official elasticsearch docs][1] + +There are so many use cases with `Common Terms` query. We highly recommend to take a look at the [official docs][1] before continuing. + +Lets take first example to write easy `Common query` with Elasticsearch DSL. + +```JSON +{ + "common": { + "name": { + "query": "this is bonsai cool", + "cutoff_frequency": 0.001, + "minimum_should_match": { + "low_freq" : 2, + "high_freq" : 3 + } + } + } +} +``` + +And now the query via DSL: + +```php +$commonTermsQuery = new CommonTermsQuery( + "field_name", + "this is bonsai cool", + [ + "cutoff_frequency" => 0.001, + "minimum_should_match" => [ + "low_freq" => 2, + "high_freq" => 3, + ], + ] +); + +$search = new Search(); +$search->addQuery($commonTermsQuery); + +$queryArray = $search->toArray(); +``` + + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-common-terms-query.html -- GitLab