From bbee2931ab30146434a767b871dae9c5222620e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simonas=20=C5=A0erlinskas?= <simonas.serlinskas@nfq.com> Date: Tue, 30 Jun 2015 11:25:43 +0300 Subject: [PATCH] added docs index and query index pages --- docs/Query/Wildcard.md | 1 + docs/Query/index.md | 67 ++++++++++++++++++++++++++++++++++++++++++ docs/index.md | 16 ++++++++++ 3 files changed, 84 insertions(+) create mode 100644 docs/Query/Wildcard.md create mode 100644 docs/Query/index.md create mode 100644 docs/index.md diff --git a/docs/Query/Wildcard.md b/docs/Query/Wildcard.md new file mode 100644 index 0000000..4c646c5 --- /dev/null +++ b/docs/Query/Wildcard.md @@ -0,0 +1 @@ +# Wildcard Query \ No newline at end of file diff --git a/docs/Query/index.md b/docs/Query/index.md new file mode 100644 index 0000000..a2d4d91 --- /dev/null +++ b/docs/Query/index.md @@ -0,0 +1,67 @@ +# Query + +Objective query builder represents all available [Elasticsearch queries][1]. + +To form a query you have to create `Search` object. See below an example of match all query usage. + +```php +$search = new Search(); +$matchAllQuery = new MatchAllQuery(); +$search->addQuery($matchAllQuery); +$queryArray = $search->toArray(); +``` + +```php +//$queryArray content +'query' => + [ + 'match_all' => \stdClass(), + ] +``` + +So now you can easily pass it to the elasticsearch-php client: + +```php +//from elasticsearch/elasticsearch package +$client = new Elasticsearch\Client(); + +$searchParams = [ + 'index' => 'people', + 'type' => 'person', + 'body' => $queryArray +]; + +$docs = $client->search($searchParams); +``` +> This example works with elasticsearch/elasticsearch ~1.0 version. + + +## Queries: + - [Bool](Bool.md) + - [Boosting](Boosting.md) + - [Common terms](CommonTerms.md) + - [Constant Score](ConstantScore.md) + - [DisMax](DisMax.md) + - [Filtered](Filtered.md) + - [Function score](FunctionScore.md) + - [Fuzzy](Fuzzy.md) + - [Fuzzy like this field](FuzzyLikeThisField.md) + - [Fuzzy like this query](FuzzyLikeThisQuery.md) + - [Has child](HasChild.md) + - [Has parent](HasParent.md) + - [Ids](Ids.md) + - [Indices](Indices.md) + - [Match all](MatchAll.md) + - [Match](Match.md) + - [More like this](MoreLikeThis.md) + - [Multi match](MultiMatch.md) + - [Nested](Nested.md) + - [Prefix](Prefix.md) + - [Query string](QueryString.md) + - [Range](Range.md) + - [Simple query string](SimpleQueryString.md) + - [Term](Term.md) + - [Terms](Terms.md) + - [Wildcard](Wildcard.md) + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-queries.html diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..bab2efd --- /dev/null +++ b/docs/index.md @@ -0,0 +1,16 @@ +# Elasticsearch DSL + +Welcome to Elasticsearch DSL library. The main purpose of this library is to provide objective query builder for [elasticsearch-php][1] client. + +Everything starts from the `Search` object. We recommend first to take a look at the [Search](How to/HowToSearch.md) chapter. + +### Topics: +- [Build Queries](Query/index.md) +- [Build Filters] +- [Build Aggregations] + +### How to +- [How to combine `Filter` and `Query`] +- [How to add sorting] + +[1] https://github.com/elastic/elasticsearch-php -- GitLab