From 87c7ac12927aac4eecef8da188885e894921dbe1 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Wed, 8 Jul 2015 13:34:11 +0300 Subject: [PATCH] Add aggregation doc. --- docs/Aggregation/index.md | 49 +++++++++++++++++++++++++++++++++++++++ docs/index.md | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 docs/Aggregation/index.md diff --git a/docs/Aggregation/index.md b/docs/Aggregation/index.md new file mode 100644 index 0000000..571f9c1 --- /dev/null +++ b/docs/Aggregation/index.md @@ -0,0 +1,49 @@ +# Aggregation + +Objective aggregation builder represents all available [Elasticsearch aggregations][1]. + + +To form an aggregation you have to create `Search` object. See below an example of min aggregation usage. + +```php +$search = new Search(); +$minAggregation = new MinAggregation('min_agg'); +$minAggregation->setField('price'); +$search->addAggregation($minAggregation); +$queryArray = $search->toArray(); +``` + +There are 2 types of aggregation: bucketing and metric. The only difference in using them is that metric bucketing +aggregations supports nesting while metric aggregations will ignore any set nested aggregations. + +## Metric Aggregations + - [Avg](Avg.md) + - [Cardinality](Cardinality.md) + - [ExtendedStats](ExtendedStats.md) + - [Max](Max.md) + - [Min](Min.md) + - [PercentileRanks](PercentileRanks.md) + - [Percentiles](Percentiles.md) + - [Stats](Stats.md) + - [Sum](Sum.md) + - [TopHits](TopHits.md) + - [ValueCount](ValueCount.md) + +## Bucketing Aggregations + - [Children](Children.md) + - [DateRange](DateRange.md) + - [Filter](Filter.md) + - [Filters](Filters.md) + - [GeoBounds](GeoBounds.md) + - [GeoDistance](GeoDistance.md) + - [GeoHashGrid](GeoHashGrid.md) + - [Global](Global.md) + - [Histogram](Histogram.md) + - [Ipv4Range](Ipv4Range.md) + - [Missing](Missing.md) + - [Nested](Nested.md) + - [Range](Range.md) + - [ReverseNested](ReverseNested.md) + - [Terms](Terms.md) + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html diff --git a/docs/index.md b/docs/index.md index 81b8256..4ab5421 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,7 +7,7 @@ Everything starts from the `Search` object. We recommend first to take a look at ### Topics: - [Build Queries](Query/index.md) - [Build Filters](Filter/index.md) -- [Build Aggregations] +- [Build Aggregations](Aggregation/index.md) ### How to - [How to combine `Filter` and `Query`] -- GitLab