From 3902dd30bf4dc446580819941215ee9229bbc5e6 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Fri, 3 Jul 2015 14:17:52 +0300 Subject: [PATCH] Add simple query string query doc. --- docs/Query/SimpleQueryString.md | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/Query/SimpleQueryString.md diff --git a/docs/Query/SimpleQueryString.md b/docs/Query/SimpleQueryString.md new file mode 100644 index 0000000..8f21ded --- /dev/null +++ b/docs/Query/SimpleQueryString.md @@ -0,0 +1,38 @@ +# Simple Query String Query + +> More info about simple query string query is in the [official elasticsearch docs][1] + +A query that uses the SimpleQueryParser to parse its context + +## Simple example + +```JSON +{ + "simple_query_string" : { + "query": "\"fried eggs\" +(eggplant | potato) -frittata", + "analyzer": "snowball", + "fields": ["body^5","_all"], + "default_operator": "and" + } +} +``` + +In DSL: + +```php +$simpleQueryStringQuery = new SimpleQueryStringQuery( + '"fried eggs" +(eggplant | potato) -frittata', + [ + 'analyzer' => 'snowball', + 'fields' => ['body^5', '_all'], + 'default_operator' => 'and', + ] +); + +$search = new Search(); +$search->addQuery($simpleQueryStringQuery); + +$queryArray = $search->toArray(); +``` + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html -- GitLab