Browse Source

CONSOLE-ify filter aggregation docs

This adds the `VIEW IN CONSOLE` and `COPY AS CURL` links to the
snippet and causes the build to execute the snippet as a test.

Relates to #18160
Nik Everett 8 years ago
parent
commit
a99bddcc7e

+ 0 - 1
docs/build.gradle

@@ -25,7 +25,6 @@ apply plugin: 'elasticsearch.docs-test'
  * entirely and have a party! There will be cake and everything.... */
  * entirely and have a party! There will be cake and everything.... */
 buildRestTests.expectedUnconvertedCandidates = [
 buildRestTests.expectedUnconvertedCandidates = [
   'reference/aggregations/bucket/diversified-sampler-aggregation.asciidoc',
   'reference/aggregations/bucket/diversified-sampler-aggregation.asciidoc',
-  'reference/aggregations/bucket/filter-aggregation.asciidoc',
   'reference/aggregations/bucket/geodistance-aggregation.asciidoc',
   'reference/aggregations/bucket/geodistance-aggregation.asciidoc',
   'reference/aggregations/bucket/geohashgrid-aggregation.asciidoc',
   'reference/aggregations/bucket/geohashgrid-aggregation.asciidoc',
   'reference/aggregations/bucket/histogram-aggregation.asciidoc',
   'reference/aggregations/bucket/histogram-aggregation.asciidoc',

+ 10 - 7
docs/reference/aggregations/bucket/filter-aggregation.asciidoc

@@ -7,10 +7,11 @@ Example:
 
 
 [source,js]
 [source,js]
 --------------------------------------------------
 --------------------------------------------------
+POST /sales/_search?size=0
 {
 {
     "aggs" : {
     "aggs" : {
-        "red_products" : {
-            "filter" : { "term": { "color": "red" } },
+        "t_shirts" : {
+            "filter" : { "term": { "type": "t-shirt" } },
             "aggs" : {
             "aggs" : {
                 "avg_price" : { "avg" : { "field" : "price" } }
                 "avg_price" : { "avg" : { "field" : "price" } }
             }
             }
@@ -18,6 +19,8 @@ Example:
     }
     }
 }
 }
 --------------------------------------------------
 --------------------------------------------------
+// CONSOLE
+// TEST[setup:sales]
 
 
 In the above example, we calculate the average price of all the products that are red.
 In the above example, we calculate the average price of all the products that are red.
 
 
@@ -27,12 +30,12 @@ Response:
 --------------------------------------------------
 --------------------------------------------------
 {
 {
     ...
     ...
-
-    "aggs" : {
-        "red_products" : {
-            "doc_count" : 100,
-            "avg_price" : { "value" : 56.3 }
+    "aggregations" : {
+        "t_shirts" : {
+            "doc_count" : 3,
+            "avg_price" : { "value" : 128.33333333333334 }
         }
         }
     }
     }
 }
 }
 --------------------------------------------------
 --------------------------------------------------
+// TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]