Skip to content

Commit 55ed42d

Browse files
colleenmcginnisgeorgewallace
authored andcommitted
add es code comments for testing
1 parent 497db4b commit 55ed42d

File tree

262 files changed

+1565
-1
lines changed

Some content is hidden

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

262 files changed

+1565
-1
lines changed

docs/reference/aggregations/pipeline.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ POST /_search
102102
}
103103
}
104104
```
105+
% TEST[setup:sales]
105106

106107
1. `buckets_path` instructs this max_bucket aggregation that we want the maximum value of the `sales` aggregation in the `sales_per_month` date histogram.
107108

@@ -146,6 +147,7 @@ POST /_search
146147
}
147148
}
148149
```
150+
% TEST[setup:sales]
149151

150152
1. `buckets_path` selects the hats and bags buckets (via `['hat']`/`['bag']``) to use in the script specifically, instead of fetching all the buckets from `sale_type` aggregation
151153

@@ -214,6 +216,7 @@ POST /sales/_search
214216
}
215217
}
216218
```
219+
% TEST[setup:sales]
217220

218221
1. By using `_bucket_count` instead of a metric name, we can filter out `histo` buckets where they contain no buckets for the `categories` aggregation
219222

@@ -226,6 +229,7 @@ An alternate syntax is supported to cope with aggregations or metrics which have
226229
```js
227230
"buckets_path": "my_percentile[99.9]"
228231
```
232+
% NOTCONSOLE
229233

230234

231235
## Dealing with gaps in the data [gap-policy]

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +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/]
9093

9194

9295
## Parameters [adjacency-matrix-agg-params]

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ POST /sales/_search?size=0
2828
}
2929
}
3030
```
31+
% TEST[setup:sales]
3132

3233
## Keys [_keys]
3334

@@ -54,6 +55,7 @@ POST /sales/_search?size=0
5455
}
5556
}
5657
```
58+
% TEST[setup:sales]
5759

5860
1. Supports expressive date [format pattern](/reference/aggregations/search-aggregations-bucket-daterange-aggregation.md#date-format-pattern)
5961

@@ -87,6 +89,7 @@ Response:
8789
}
8890
}
8991
```
92+
% TESTRESPONSE[s/.../"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
9093

9194

9295
## Intervals [_intervals]
@@ -182,6 +185,7 @@ UTC is used if no time zone is specified, three 1-hour buckets are returned star
182185
}
183186
}
184187
```
188+
% TESTRESPONSE[s/.../"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
185189

186190
If a `time_zone` of `-01:00` is specified, then midnight starts at one hour before midnight UTC:
187191

@@ -199,6 +203,7 @@ GET my-index-000001/_search?size=0
199203
}
200204
}
201205
```
206+
% TEST[continued]
202207

203208
Now three 1-hour buckets are still returned but the first bucket starts at 11:00pm on 30 September 2015 since that is the local time for the bucket in the specified time zone.
204209

@@ -229,6 +234,7 @@ Now three 1-hour buckets are still returned but the first bucket starts at 11:00
229234
}
230235
}
231236
```
237+
% TESTRESPONSE[s/.../"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
232238

233239
1. The `key_as_string` value represents midnight on each day in the specified time zone.
234240

@@ -268,6 +274,7 @@ POST /sales/_search?size=0
268274
}
269275
}
270276
```
277+
% TEST[setup:sales]
271278

272279

273280
## Missing value [_missing_value]
@@ -290,6 +297,7 @@ POST /sales/_search?size=0
290297
}
291298
}
292299
```
300+
% TEST[setup:sales]
293301

294302
1. Documents without a value in the `publish_date` field will fall into the same bucket as documents that have the value `2000-01-01`.
295303

docs/reference/aggregations/search-aggregations-bucket-categorize-text-aggregation.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ POST log-messages/_search?filter_path=aggregations
107107
}
108108
}
109109
```
110+
% TEST[setup:categorize_text]
110111

111112
Response:
112113

@@ -160,6 +161,7 @@ POST log-messages/_search?filter_path=aggregations
160161
}
161162
}
162163
```
164+
% TEST[setup:categorize_text]
163165

164166
1. The filters to apply to the analyzed tokens. It filters out tokens like `bar_123`.
165167

@@ -217,6 +219,7 @@ POST log-messages/_search?filter_path=aggregations
217219
}
218220
}
219221
```
222+
% TEST[setup:categorize_text]
220223

221224
1. The filters to apply to the analyzed tokens. It filters out tokens like `bar_123`.
222225
2. Require 11% of token weight to match before adding a message to an existing category rather than creating a new one.
@@ -279,6 +282,7 @@ POST log-messages/_search?filter_path=aggregations
279282
}
280283
}
281284
```
285+
% TEST[setup:categorize_text]
282286

283287
```console-result
284288
{

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ PUT child_example/_doc/1
5252
]
5353
}
5454
```
55+
% TEST[continued]
5556

5657
Examples of `answer` documents:
5758

@@ -86,6 +87,7 @@ PUT child_example/_doc/3?routing=1&refresh
8687
"creation_date": "2009-05-05T13:45:37.030"
8788
}
8889
```
90+
% TEST[continued]
8991

9092
The following request can be built that connects the two together:
9193

@@ -117,6 +119,7 @@ POST child_example/_search?size=0
117119
}
118120
}
119121
```
122+
% TEST[continued]
120123

121124
1. The `type` points to type / mapping with the name `answer`.
122125

@@ -216,6 +219,7 @@ Possible response:
216219
}
217220
}
218221
```
222+
% TESTRESPONSE[s/"took": 25/"took": $body.took/]
219223

220224
1. The number of question documents with the tag `file-transfer`, `windows-server-2003`, etc.
221225
2. The number of answer documents that are related to question documents with the tag `file-transfer`, `windows-server-2003`, etc.

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ For example, consider the following document:
2626
"number": [23, 65, 76]
2727
}
2828
```
29+
% NOTCONSOLE
2930

3031
Using `keyword` and `number` as source fields for the aggregation results in the following composite buckets:
3132

@@ -37,6 +38,7 @@ Using `keyword` and `number` as source fields for the aggregation results in the
3738
{ "keyword": "bar", "number": 65 }
3839
{ "keyword": "bar", "number": 76 }
3940
```
41+
% NOTCONSOLE
4042

4143
## Value sources [_value_sources]
4244

@@ -310,6 +312,7 @@ Instead of a single bucket starting at midnight, the above request groups the do
310312
}
311313
}
312314
```
315+
% TESTRESPONSE[s/.../"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
313316

314317
::::{note}
315318
The start `offset` of each bucket is calculated after `time_zone` adjustments have been made.
@@ -513,6 +516,7 @@ GET /_search
513516
}
514517
}
515518
```
519+
% TEST[s/_search/_search?filter_path=aggregations/]
516520

517521
... returns:
518522

@@ -545,6 +549,7 @@ GET /_search
545549
}
546550
}
547551
```
552+
% TESTRESPONSE[s/...//]
548553

549554
To get the next set of buckets, resend the same aggregation with the `after` parameter set to the `after_key` value returned in the response. For example, this request uses the `after_key` value provided in the previous response:
550555

@@ -709,6 +714,7 @@ GET /_search
709714
}
710715
}
711716
```
717+
% TEST[s/_search/_search?filter_path=aggregations/]
712718

713719
... returns:
714720

@@ -767,6 +773,7 @@ GET /_search
767773
}
768774
}
769775
```
776+
% TESTRESPONSE[s/...//]
770777

771778

772779
## Pipeline aggregations [search-aggregations-bucket-composite-aggregation-pipeline-aggregations]

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ A `bucket_correlation` aggregation looks like this in isolation:
5858
}
5959
}
6060
```
61+
% NOTCONSOLE
6162

6263
1. The buckets containing the values to correlate against.
6364
2. The correlation function definition.
@@ -116,6 +117,7 @@ POST correlate_latency/_search?size=0&filter_path=aggregations
116117
}
117118
}
118119
```
120+
% TEST[setup:correlate_latency]
119121

120122
1. The term buckets containing a range aggregation and the bucket correlation aggregation. Both are utilized to calculate the correlation of the term values with the latency.
121123
2. The range aggregation on the latency field. The ranges were created referencing the percentiles of the latency field.

docs/reference/aggregations/search-aggregations-bucket-count-ks-test-aggregation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ A `bucket_count_ks_test` aggregation looks like this in isolation:
3737
}
3838
}
3939
```
40+
% NOTCONSOLE
4041

4142
1. The buckets containing the values to test against.
4243
2. The alternatives to calculate.
@@ -89,6 +90,7 @@ POST correlate_latency/_search?size=0&filter_path=aggregations
8990
}
9091
}
9192
```
93+
% TEST[setup:correlate_latency]
9294

9395
1. The term buckets containing a range aggregation and the bucket correlation aggregation. Both are utilized to calculate the correlation of the term values with the latency.
9496
2. The range aggregation on the latency field. The ranges were created referencing the percentiles of the latency field.

0 commit comments

Comments
 (0)