From 1acbec7583c6b8aa72eeb39c094e80f443387dee Mon Sep 17 00:00:00 2001
From: Mantas <marc.mantas@gmail.com>
Date: Tue, 12 Jul 2016 15:21:24 +0300
Subject: [PATCH] added documentation

---
 docs/Aggregation/SamplerAgg.md | 44 ++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 docs/Aggregation/SamplerAgg.md

diff --git a/docs/Aggregation/SamplerAgg.md b/docs/Aggregation/SamplerAgg.md
new file mode 100644
index 0000000..9bc4f0f
--- /dev/null
+++ b/docs/Aggregation/SamplerAgg.md
@@ -0,0 +1,44 @@
+# Sampler Aggregation
+
+> More info about histogram aggregation is in the [official elasticsearch docs][1]
+
+A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. Optionally,
+diversity settings can be used to limit the number of matches that share a common value such as an "author".
+
+## Simple example
+
+```JSON
+{
+    "aggregations": {
+        "sample": {
+            "sampler": {
+                "shard_size": 200,
+                "field" : "user.id"
+            },
+            "aggs": {
+                 "keywords": {
+                     "significant_terms": {
+                         "field": "text"
+                     }
+                 }
+            }
+        }
+    }
+}
+```
+
+And now the query via DSL:
+
+```php
+$samplerAggregation = new SamplerAggregation('sample', 'user.id', 200);
+$samplerAggregation->addAggregation(
+    new SignificantTermsAggregation('keywords', 'text')
+);
+
+$search = new Search();
+$search->addAggregation($samplerAggregation);
+
+$queryArray = $search->toArray();
+```
+
+[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-sampler-aggregation.html
-- 
GitLab