Skip to content

Commit c71e062

Browse files
more sample testing (#136994)
* more sample testing * more examples * end of rest api examples * final sample testing comments * more sample snippet fixes * fixing highlighting-examples * additional fixes * more example updaters
1 parent e946ca8 commit c71e062

File tree

177 files changed

+900
-850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+900
-850
lines changed

docs/reference/aggregations/search-aggregations-bucket-adjacency-matrix-aggregation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ The response contains buckets with document counts for each filter and combinati
8787
}
8888
}
8989
```
90-
% TESTRESPONSE[s/"took": 9/"took": $body.took/]
91-
% TESTRESPONSE[s/"_shards": \.\.\./"_shards": $body._shards/]
92-
% TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
90+
% TESTRESPONSE[s/"took": 9/"took": $body.took/]
91+
% TESTRESPONSE[s/"_shards": \.\.\./"_shards": $body._shards/]
92+
% TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
9393

9494
## Parameters [adjacency-matrix-agg-params]
9595

docs/reference/aggregations/search-aggregations-bucket-datehistogram-aggregation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ POST /sales/_search?size=0
8989
}
9090
}
9191
```
92-
% TEST[setup:sales]
93-
% TEST[catch:bad_request]
92+
% TEST[setup:sales]
93+
% TEST[catch:bad_request]
9494

9595
```js
9696
{
@@ -172,8 +172,8 @@ POST /sales/_search?size=0
172172
}
173173
}
174174
```
175-
% TEST[setup:sales]
176-
% TEST[catch:bad_request]
175+
% TEST[setup:sales]
176+
% TEST[catch:bad_request]
177177

178178
```js
179179
{

docs/reference/aggregations/search-aggregations-bucket-diversified-sampler-aggregation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ Response:
8080
}
8181
}
8282
```
83-
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
84-
% TESTRESPONSE[s/2.213/$body.aggregations.my_unbiased_sample.keywords.buckets.0.score/]
83+
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
84+
% TESTRESPONSE[s/2.213/$body.aggregations.my_unbiased_sample.keywords.buckets.0.score/]
8585

8686
1. 151 documents were sampled in total.
8787
2. The results of the significant_terms aggregation are not skewed by any single author’s quirks because we asked for a maximum of one post from any one author in our sample.
@@ -158,9 +158,9 @@ Response:
158158
}
159159
}
160160
```
161-
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
162-
% TESTRESPONSE[s/2.213/$body.aggregations.my_unbiased_sample.keywords.buckets.0.score/]
163-
% TESTRESPONSE[s/1.34/$body.aggregations.my_unbiased_sample.keywords.buckets.1.score/]
161+
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
162+
% TESTRESPONSE[s/2.213/$body.aggregations.my_unbiased_sample.keywords.buckets.0.score/]
163+
% TESTRESPONSE[s/1.34/$body.aggregations.my_unbiased_sample.keywords.buckets.1.score/]
164164

165165
## shard_size [_shard_size]
166166

docs/reference/aggregations/search-aggregations-bucket-filters-aggregation.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ Response:
6262
}
6363
}
6464
```
65-
% TESTRESPONSE[s/"took": 9/"took": $body.took/]
66-
% TESTRESPONSE[s/"_shards": \.\.\./"_shards": $body._shards/]
67-
% TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
65+
% TESTRESPONSE[s/"took": 9/"took": $body.took/]
66+
% TESTRESPONSE[s/"_shards": \.\.\./"_shards": $body._shards/]
67+
% TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
6868

6969
## Anonymous filters [anonymous-filters]
7070

@@ -112,9 +112,9 @@ The filtered buckets are returned in the same order as provided in the request.
112112
}
113113
}
114114
```
115-
% TESTRESPONSE[s/"took": 4/"took": $body.took/]
116-
% TESTRESPONSE[s/"_shards": \.\.\./"_shards": $body._shards/]
117-
% TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
115+
% TESTRESPONSE[s/"took": 4/"took": $body.took/]
116+
% TESTRESPONSE[s/"_shards": \.\.\./"_shards": $body._shards/]
117+
% TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
118118

119119
## `Other` Bucket [other-bucket]
120120

@@ -181,9 +181,9 @@ The response would be something like the following:
181181
}
182182
}
183183
```
184-
% TESTRESPONSE[s/"took": 3/"took": $body.took/]
185-
% TESTRESPONSE[s/"_shards": \.\.\./"_shards": $body._shards/]
186-
% TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
184+
% TESTRESPONSE[s/"took": 3/"took": $body.took/]
185+
% TESTRESPONSE[s/"_shards": \.\.\./"_shards": $body._shards/]
186+
% TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
187187

188188
## Non-keyed Response [non-keyed-response]
189189

docs/reference/aggregations/search-aggregations-bucket-histogram-aggregation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ The `histogram` aggregation will sum the counts of each interval computed based
375375
}
376376
}
377377
```
378-
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
378+
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
379379

380380
::::{important}
381381
Histogram aggregation is a bucket aggregation, which partitions documents into buckets rather than calculating metrics over fields like metrics aggregations do. Each bucket represents a collection of documents which sub-aggregations can run on. On the other hand, a histogram field is a pre-aggregated field representing multiple values inside a single field: buckets of numerical data and a count of items/documents for each bucket. This mismatch between the histogram aggregations expected input (expecting raw documents) and the histogram field (that provides summary information) limits the outcome of the aggregation to only the doc counts for each bucket.

docs/reference/aggregations/search-aggregations-bucket-nested-aggregation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ GET /products/_search?size=0
8686
}
8787
}
8888
```
89-
% TEST[s/size=0/size=0&filter_path=aggregations/]
90-
% TEST[continued]
89+
% TEST[s/size=0/size=0&filter_path=aggregations/]
90+
% TEST[continued]
9191

9292
As you can see above, the nested aggregation requires the `path` of the nested documents within the top level documents. Then one can define any type of aggregation over these nested documents.
9393

@@ -149,8 +149,8 @@ GET /products/_search?size=0
149149
}
150150
}
151151
```
152-
% TEST[s/size=0/size=0&filter_path=aggregations/]
153-
% TEST[continued]
152+
% TEST[s/size=0/size=0&filter_path=aggregations/]
153+
% TEST[continued]
154154

155155
The search returns:
156156

docs/reference/aggregations/search-aggregations-bucket-range-aggregation.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ GET sales/_search
3030
}
3131
}
3232
```
33-
% TEST[setup:sales]
34-
% TEST[s/_search/_search\?filter_path=aggregations/]
33+
% TEST[setup:sales]
34+
% TEST[s/_search/_search\?filter_path=aggregations/]
3535

3636
Response:
3737

@@ -88,8 +88,8 @@ GET sales/_search
8888
}
8989
}
9090
```
91-
% TEST[setup:sales]
92-
% TEST[s/_search/_search\?filter_path=aggregations/]
91+
% TEST[setup:sales]
92+
% TEST[s/_search/_search\?filter_path=aggregations/]
9393

9494
Response:
9595

@@ -141,8 +141,8 @@ GET sales/_search
141141
}
142142
}
143143
```
144-
% TEST[setup:sales]
145-
% TEST[s/_search/_search\?filter_path=aggregations/]
144+
% TEST[setup:sales]
145+
% TEST[s/_search/_search\?filter_path=aggregations/]
146146

147147
Response:
148148

@@ -208,8 +208,8 @@ GET sales/_search
208208
}
209209
}
210210
```
211-
% TEST[setup:sales]
212-
% TEST[s/_search/_search\?filter_path=aggregations/]
211+
% TEST[setup:sales]
212+
% TEST[s/_search/_search\?filter_path=aggregations/]
213213

214214
## Sub Aggregations [_sub_aggregations_2]
215215

@@ -239,8 +239,8 @@ GET sales/_search
239239
}
240240
}
241241
```
242-
% TEST[setup:sales]
243-
% TEST[s/_search/_search\?filter_path=aggregations/]
242+
% TEST[setup:sales]
243+
% TEST[s/_search/_search\?filter_path=aggregations/]
244244

245245
Response:
246246

docs/reference/aggregations/search-aggregations-bucket-reverse-nested-aggregation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ GET /issues/_search
8282
}
8383
}
8484
```
85-
% TEST[continued]
86-
% TEST[s/_search/_search\?filter_path=aggregations/]
85+
% TEST[continued]
86+
% TEST[s/_search/_search\?filter_path=aggregations/]
8787

8888
As you can see above, the `reverse_nested` aggregation is put in to a `nested` aggregation as this is the only place in the dsl where the `reverse_nested` aggregation can be used. Its sole purpose is to join back to a parent doc higher up in the nested structure.
8989

docs/reference/aggregations/search-aggregations-bucket-sampler-aggregation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ Response:
138138
}
139139
}
140140
```
141-
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
142-
% TESTRESPONSE[s/0.02777/$body.aggregations.low_quality_keywords.buckets.0.score/]
143-
% TESTRESPONSE[s/0.0069/$body.aggregations.low_quality_keywords.buckets.2.score/]
141+
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
142+
% TESTRESPONSE[s/0.02777/$body.aggregations.low_quality_keywords.buckets.0.score/]
143+
% TESTRESPONSE[s/0.0069/$body.aggregations.low_quality_keywords.buckets.2.score/]
144144

145145
## shard_size [_shard_size_2]
146146

docs/reference/aggregations/search-aggregations-bucket-significantterms-aggregation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ Response:
9898
}
9999
}
100100
```
101-
% TESTRESPONSE[s/\.\.\.//]
102-
% TESTRESPONSE[s/: (0\.)?[0-9]+/: $body.$_path/]
101+
% TESTRESPONSE[s/\.\.\.//]
102+
% TESTRESPONSE[s/: (0\.)?[0-9]+/: $body.$_path/]
103103

104104
When querying an index of all crimes from all police forces, what these results show is that the British Transport Police force stand out as a force dealing with a disproportionately large number of bicycle thefts. Ordinarily, bicycle thefts represent only 1% of crimes (66799/5064554) but for the British Transport Police, who handle crime on railways and stations, 7% of crimes (3640/47347) is a bike theft. This is a significant seven-fold increase in frequency and so this anomaly was highlighted as the top crime type.
105105

@@ -182,9 +182,9 @@ Response:
182182
}
183183
}
184184
```
185-
% TESTRESPONSE[s/\.\.\.//]
186-
% TESTRESPONSE[s/: (0\.)?[0-9]+/: $body.$_path/]
187-
% TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
185+
% TESTRESPONSE[s/\.\.\.//]
186+
% TESTRESPONSE[s/: (0\.)?[0-9]+/: $body.$_path/]
187+
% TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
188188

189189
Now we have anomaly detection for each of the police forces using a single request.
190190

0 commit comments

Comments
 (0)