Skip to content

Commit 86df1b3

Browse files
author
Hendrik Muhs
authored
[DOCS] enhance transform example with range filter (elastic#74284)
enhance transform example using range instead of terms for 5xx error codes
1 parent 632901f commit 86df1b3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

docs/reference/transform/examples.asciidoc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ PUT _transform/suspicious_client_ips
247247
"filter": {
248248
"term": { "response" : "404"}}
249249
},
250-
"error503" : {
251-
"filter": {
252-
"term": { "response" : "503"}}
250+
"error5xx" : {
251+
"filter": {
252+
"range": { "response" : { "gte": 500, "lt": 600}}}
253253
},
254254
"timestamp.min": { "min": { "field": "timestamp" }},
255255
"timestamp.max": { "max": { "field": "timestamp" }},
@@ -273,9 +273,10 @@ PUT _transform/suspicious_client_ips
273273
field to synchronize the source and destination indices. The worst case
274274
ingestion delay is 60 seconds.
275275
<3> The data is grouped by the `clientip` field.
276-
<4> Filter aggregation that counts the occurrences of successful (`200`)
277-
responses in the `response` field. The following two aggregations (`error404`
278-
and `error503`) count the error responses by error codes.
276+
<4> Filter aggregation that counts the occurrences of successful (`200`)
277+
responses in the `response` field. The following two aggregations (`error404`
278+
and `error5xx`) count the error responses by error codes, matching an exact
279+
value or a range of response codes.
279280
<5> This `bucket_script` calculates the duration of the `clientip` access based
280281
on the results of the aggregation.
281282

0 commit comments

Comments
 (0)