Skip to content

Commit 1d277b8

Browse files
author
Hendrik Muhs
committed
[DOCS] enhance transform example with range filter (#74284)
enhance transform example using range instead of terms for 5xx error codes
1 parent 6ab6bee commit 1d277b8

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
@@ -246,9 +246,9 @@ PUT _transform/suspicious_client_ips
246246
"filter": {
247247
"term": { "response" : "404"}}
248248
},
249-
"error503" : {
250-
"filter": {
251-
"term": { "response" : "503"}}
249+
"error5xx" : {
250+
"filter": {
251+
"range": { "response" : { "gte": 500, "lt": 600}}}
252252
},
253253
"timestamp.min": { "min": { "field": "timestamp" }},
254254
"timestamp.max": { "max": { "field": "timestamp" }},
@@ -272,9 +272,10 @@ PUT _transform/suspicious_client_ips
272272
field to synchronize the source and destination indices. The worst case
273273
ingestion delay is 60 seconds.
274274
<3> The data is grouped by the `clientip` field.
275-
<4> Filter aggregation that counts the occurrences of successful (`200`)
276-
responses in the `response` field. The following two aggregations (`error404`
277-
and `error503`) count the error responses by error codes.
275+
<4> Filter aggregation that counts the occurrences of successful (`200`)
276+
responses in the `response` field. The following two aggregations (`error404`
277+
and `error5xx`) count the error responses by error codes, matching an exact
278+
value or a range of response codes.
278279
<5> This `bucket_script` calculates the duration of the `clientip` access based
279280
on the results of the aggregation.
280281

0 commit comments

Comments
 (0)