Skip to content

Commit 584cb0d

Browse files
Florian Kelbertjrodewig
Florian Kelbert
authored andcommitted
[DOCS] Correctly read total hits inside watcher config (#50614)
With #35848, users can now retrieve total hits as an integer when the `rest_total_hits_as_int` query parameter is `true`. This is the default value. This updates several snippet examples in the Watcher docs that used a workaround to get a total hits integer.
1 parent 1211772 commit 584cb0d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

x-pack/docs/en/watcher/actions.asciidoc

+9-9
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ PUT _watcher/watch/error_logs_alert
6969
}
7070
},
7171
"condition" : {
72-
"compare" : { "ctx.payload.hits.total.value" : { "gt" : 5 }}
72+
"compare" : { "ctx.payload.hits.total" : { "gt" : 5 }}
7373
},
7474
"actions" : {
7575
"email_administrator" : {
7676
"throttle_period": "15m", <1>
7777
"email" : { <2>
7878
79-
"subject" : "Encountered {{ctx.payload.hits.total.value}} errors",
79+
"subject" : "Encountered {{ctx.payload.hits.total}} errors",
8080
"body" : "Too many error in the system, see attached data",
8181
"attachments" : {
8282
"attached_data" : {
@@ -119,14 +119,14 @@ PUT _watcher/watch/log_event_watch
119119
}
120120
},
121121
"condition" : {
122-
"compare" : { "ctx.payload.hits.total.value" : { "gt" : 5 }}
122+
"compare" : { "ctx.payload.hits.total" : { "gt" : 5 }}
123123
},
124124
"throttle_period" : "15m", <1>
125125
"actions" : {
126126
"email_administrator" : {
127127
"email" : {
128128
129-
"subject" : "Encountered {{ctx.payload.hits.total.value}} errors",
129+
"subject" : "Encountered {{ctx.payload.hits.total}} errors",
130130
"body" : "Too many error in the system, see attached data",
131131
"attachments" : {
132132
"attached_data" : {
@@ -144,7 +144,7 @@ PUT _watcher/watch/log_event_watch
144144
"host" : "pager.service.domain",
145145
"port" : 1234,
146146
"path" : "/{{watch_id}}",
147-
"body" : "Encountered {{ctx.payload.hits.total.value}} errors"
147+
"body" : "Encountered {{ctx.payload.hits.total}} errors"
148148
}
149149
}
150150
}
@@ -265,13 +265,13 @@ PUT _watcher/watch/log_event_watch
265265
}
266266
},
267267
"condition" : {
268-
"compare" : { "ctx.payload.hits.total.value" : { "gt" : 0 } }
268+
"compare" : { "ctx.payload.hits.total" : { "gt" : 0 } }
269269
},
270270
"actions" : {
271271
"email_administrator" : {
272272
"email" : {
273273
274-
"subject" : "Encountered {{ctx.payload.hits.total.value}} errors",
274+
"subject" : "Encountered {{ctx.payload.hits.total}} errors",
275275
"body" : "Too many error in the system, see attached data",
276276
"attachments" : {
277277
"attached_data" : {
@@ -285,14 +285,14 @@ PUT _watcher/watch/log_event_watch
285285
},
286286
"notify_pager" : {
287287
"condition": { <1>
288-
"compare" : { "ctx.payload.hits.total.value" : { "gt" : 5 } }
288+
"compare" : { "ctx.payload.hits.total" : { "gt" : 5 } }
289289
},
290290
"webhook" : {
291291
"method" : "POST",
292292
"host" : "pager.service.domain",
293293
"port" : 1234,
294294
"path" : "/{{watch_id}}",
295-
"body" : "Encountered {{ctx.payload.hits.total.value}} errors"
295+
"body" : "Encountered {{ctx.payload.hits.total}} errors"
296296
}
297297
}
298298
}

0 commit comments

Comments
 (0)