From e52ccf014cfbb05b2a6756536866786faa0c6547 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Thu, 2 Jul 2015 13:18:44 +0300 Subject: [PATCH] Add more like this query doc. --- docs/Query/MoreLikeThis.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/Query/MoreLikeThis.md diff --git a/docs/Query/MoreLikeThis.md b/docs/Query/MoreLikeThis.md new file mode 100644 index 0000000..7777e31 --- /dev/null +++ b/docs/Query/MoreLikeThis.md @@ -0,0 +1,38 @@ +# More Like This Query + +> More info about more like this query is in the [official elasticsearch docs][1] + +The More Like This Query (MLT Query) finds documents that are "like" a given set of documents. + +## Simple example + +```JSON +{ + "more_like_this" : { + "fields" : ["title", "description"], + "like_text" : "Once upon a time", + "min_term_freq" : 1, + "max_query_terms" : 12 + } +} +``` + +In DSL: + +```php +$moreLikeThisQuery = new MoreLikeThisQuery( + 'Once upon a time', + [ + 'fields' => ['title', 'description'], + 'min_term_freq' => 1, + 'max_query_terms' => 12, + ] +); + +$search = new Search(); +$search->addQuery($moreLikeThisQuery); + +$queryArray = $search->toArray(); +``` + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-mlt-query.html -- GitLab