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
This commit is contained in:
parent
40e2645177
commit
a99bddcc7e
|
@ -25,7 +25,6 @@ apply plugin: 'elasticsearch.docs-test'
|
|||
* entirely and have a party! There will be cake and everything.... */
|
||||
buildRestTests.expectedUnconvertedCandidates = [
|
||||
'reference/aggregations/bucket/diversified-sampler-aggregation.asciidoc',
|
||||
'reference/aggregations/bucket/filter-aggregation.asciidoc',
|
||||
'reference/aggregations/bucket/geodistance-aggregation.asciidoc',
|
||||
'reference/aggregations/bucket/geohashgrid-aggregation.asciidoc',
|
||||
'reference/aggregations/bucket/histogram-aggregation.asciidoc',
|
||||
|
|
|
@ -7,10 +7,11 @@ Example:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST /sales/_search?size=0
|
||||
{
|
||||
"aggs" : {
|
||||
"red_products" : {
|
||||
"filter" : { "term": { "color": "red" } },
|
||||
"t_shirts" : {
|
||||
"filter" : { "term": { "type": "t-shirt" } },
|
||||
"aggs" : {
|
||||
"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.
|
||||
|
||||
|
@ -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,/]
|
||||
|
|
Loading…
Reference in New Issue