Skip to content

Commit 643a8d7

Browse files
jrodewigelasticmachineErni
authored
[DOCS] Change ctx.payload.hits.total.value to ctx.payload.hits.total (#65874) (#66032)
Co-authored-by: James Rodewig <[email protected]> Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Ernesto Reig <[email protected]>
1 parent 32db23a commit 643a8d7

10 files changed

+23
-23
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ The following snippet shows a simple jira action definition:
2828
"issuetype" : {
2929
"name": "Bug" <3>
3030
},
31-
"summary" : "Encountered {{ctx.payload.hits.total.value}} errors in the last 5 minutes", <4>
32-
"description" : "Encountered {{ctx.payload.hits.total.value}} errors in the last 5 minutes (facepalm)", <5>
31+
"summary" : "Encountered {{ctx.payload.hits.total}} errors in the last 5 minutes", <4>
32+
"description" : "Encountered {{ctx.payload.hits.total}} errors in the last 5 minutes (facepalm)", <5>
3333
"labels" : ["auto"], <6>
3434
"priority" : {
3535
"name" : "High" <7>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The following snippet shows a simple slack action definition:
2424
"slack" : {
2525
"message" : {
2626
"to" : [ "#admins", "@chief-admin" ], <1>
27-
"text" : "Encountered {{ctx.payload.hits.total.value}} errors in the last 5 minutes (facepalm)" <2>
27+
"text" : "Encountered {{ctx.payload.hits.total}} errors in the last 5 minutes (facepalm)" <2>
2828
}
2929
}
3030
}
@@ -59,7 +59,7 @@ The following snippet shows a standard message attachment:
5959
"attachments" : [
6060
{
6161
"title" : "Errors Found",
62-
"text" : "Encountered {{ctx.payload.hits.total.value}} errors in the last 5 minutes (facepalm)",
62+
"text" : "Encountered {{ctx.payload.hits.total}} errors in the last 5 minutes (facepalm)",
6363
"color" : "danger"
6464
}
6565
]

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The following snippet shows a simple webhook action definition:
2525
"host" : "mylisteningserver", <5>
2626
"port" : 9200, <6>
2727
"path": ":/{{ctx.watch_id}}", <7>
28-
"body" : "{{ctx.watch_id}}:{{ctx.payload.hits.total.value}}" <8>
28+
"body" : "{{ctx.watch_id}}:{{ctx.payload.hits.total}}" <8>
2929
}
3030
}
3131
}
@@ -50,7 +50,7 @@ For example, the following `webhook` action creates a new issue in GitHub:
5050
"actions" : {
5151
"create_github_issue" : {
5252
"transform": {
53-
"script": "return ['title':'Found errors in \\'contact.html\\'', 'body' : 'Found ' + ctx.payload.hits.total.value + ' errors in the last 5 minutes', 'assignee' : 'web-admin', 'labels' : ['bug','sev2']]"
53+
"script": "return ['title':'Found errors in \\'contact.html\\'', 'body' : 'Found ' + ctx.payload.hits.total + ' errors in the last 5 minutes', 'assignee' : 'web-admin', 'labels' : ['bug','sev2']]"
5454
},
5555
"webhook" : {
5656
"method" : "POST",
@@ -127,7 +127,7 @@ the values serve as the header values:
127127
"headers" : {
128128
"Content-Type" : "application/yaml" <1>
129129
},
130-
"body" : "count: {{ctx.payload.hits.total.value}}"
130+
"body" : "count: {{ctx.payload.hits.total}}"
131131
}
132132
}
133133
}

x-pack/docs/en/watcher/customizing-watches.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ returned any hits:
147147
[source,js]
148148
--------------------------------------------------
149149
"condition" : {
150-
"compare" : { "ctx.payload.hits.total.value" : { "gt" : 0 }}
150+
"compare" : { "ctx.payload.hits.total" : { "gt" : 0 }}
151151
},
152152
--------------------------------------------------
153153
// NOTCONSOLE
@@ -223,7 +223,7 @@ attaches the payload data to the message:
223223
"email" : { <2>
224224
225225
"subject" : "Watcher Notification",
226-
"body" : "{{ctx.payload.hits.total.value}} error logs found",
226+
"body" : "{{ctx.payload.hits.total}} error logs found",
227227
"attachments" : {
228228
"data_attachment" : {
229229
"data" : {
@@ -252,7 +252,7 @@ creates a new issue in GitHub
252252
"url" : "https://api.github.com/repos/<owner>/<repo>/issues", <1>
253253
"body" : "{
254254
\"title\": \"Found errors in 'contact.html'\",
255-
\"body\": \"Found {{ctx.payload.hits.total.value}} errors in this page in the last 5 minutes\",
255+
\"body\": \"Found {{ctx.payload.hits.total}} errors in this page in the last 5 minutes\",
256256
\"assignee\": \"web-admin\",
257257
\"labels\": [ \"bug\", \"sev2\" ]
258258
}",

x-pack/docs/en/watcher/example-watches/watching-time-series-data.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ You define the condition with the following script:
107107
+
108108
[source,text]
109109
--------------------------------------------------
110-
return ctx.payload.hits.total.value > threshold
110+
return ctx.payload.hits.total > threshold
111111
--------------------------------------------------
112112
+
113113
If you store the script in a file at `$ES_HOME/config/scripts/threshold_hits.painless`,
@@ -204,7 +204,7 @@ PUT _watcher/watch/rss_watch
204204
}
205205
}
206206
--------------------------------------------------
207-
// TEST[s/"id" : "threshold_hits"/"source": "return ctx.payload.hits.total.value > params.threshold"/]
207+
// TEST[s/"id" : "threshold_hits"/"source": "return ctx.payload.hits.total > params.threshold"/]
208208

209209
<1> Replace `[email protected]` with your email address to receive
210210
notifications.

x-pack/docs/en/watcher/getting-started.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ PUT _watcher/watch/log_error_watch
103103
}
104104
},
105105
"condition" : {
106-
"compare" : { "ctx.payload.hits.total.value" : { "gt" : 0 }} <1>
106+
"compare" : { "ctx.payload.hits.total" : { "gt" : 0 }} <1>
107107
}
108108
}
109109
--------------------------------------------------
@@ -180,12 +180,12 @@ PUT _watcher/watch/log_error_watch
180180
}
181181
},
182182
"condition" : {
183-
"compare" : { "ctx.payload.hits.total.value" : { "gt" : 0 }}
183+
"compare" : { "ctx.payload.hits.total" : { "gt" : 0 }}
184184
},
185185
"actions" : {
186186
"log_error" : {
187187
"logging" : {
188-
"text" : "Found {{ctx.payload.hits.total.value}} errors in the logs"
188+
"text" : "Found {{ctx.payload.hits.total}} errors in the logs"
189189
}
190190
}
191191
}

x-pack/docs/en/watcher/how-watcher-works.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ PUT _watcher/watch/log_errors
7171
}
7272
},
7373
"condition" : { <4>
74-
"compare" : { "ctx.payload.hits.total.value" : { "gt" : 5 }}
74+
"compare" : { "ctx.payload.hits.total" : { "gt" : 5 }}
7575
},
7676
"transform" : { <5>
7777
"search" : {
@@ -90,13 +90,13 @@ PUT _watcher/watch/log_errors
9090
"host" : "mylisteninghost",
9191
"port" : 9200,
9292
"path" : "/{{watch_id}}",
93-
"body" : "Encountered {{ctx.payload.hits.total.value}} errors"
93+
"body" : "Encountered {{ctx.payload.hits.total}} errors"
9494
}
9595
},
9696
"email_administrator" : {
9797
"email" : {
9898
99-
"subject" : "Encountered {{ctx.payload.hits.total.value}} errors",
99+
"subject" : "Encountered {{ctx.payload.hits.total}} errors",
100100
"body" : "Too many error in the system, see attached data",
101101
"attachments" : {
102102
"attached_data" : {

x-pack/docs/en/watcher/input/search.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ a condition to check if the search returned more than five hits:
129129
}
130130
},
131131
"condition" : {
132-
"compare" : { "ctx.payload.hits.total.value" : { "gt" : 5 }}
132+
"compare" : { "ctx.payload.hits.total" : { "gt" : 5 }}
133133
}
134134
...
135135
}
@@ -142,7 +142,7 @@ Conditions, transforms, and actions can access the search results through the
142142
watch execution context. For example:
143143

144144
* To load all of the search hits into an email body, use `ctx.payload.hits`.
145-
* To reference the total number of hits, use `ctx.payload.hits.total.value`.
145+
* To reference the total number of hits, use `ctx.payload.hits.total`.
146146
* To access a particular hit, use its zero-based array index. For example, to
147147
get the third hit, use `ctx.payload.hits.hits.2`.
148148
* To get a field value from a particular hit, use

x-pack/docs/en/watcher/java/put-watch.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ SearchInput input = new SearchInput(new WatcherSearchTemplateRequest(new String[
4646
watchSourceBuilder.input(input);
4747
4848
// Set the condition
49-
watchSourceBuilder.condition(new ScriptCondition(new Script("ctx.payload.hits.total.value > 1")));
49+
watchSourceBuilder.condition(new ScriptCondition(new Script("ctx.payload.hits.total > 1")));
5050
5151
// Create the email template to use for the action
5252
EmailTemplate.Builder emailBuilder = EmailTemplate.builder();
@@ -78,7 +78,7 @@ PutWatchResponse putWatchResponse2 = watcherClient.preparePutWatch("my-watch")
7878
.filter(rangeQuery("date").gt("{{ctx.trigger.scheduled_time}}"))
7979
.filter(rangeQuery("date").lt("{{ctx.execution_time}}"))
8080
).buildAsBytes())))
81-
.condition(compareCondition("ctx.payload.hits.total.value", CompareCondition.Op.GT, 1L))
81+
.condition(compareCondition("ctx.payload.hits.total", CompareCondition.Op.GT, 1L))
8282
.addAction("email_someone", emailAction(EmailTemplate.builder()
8383
8484
.subject("404 recently encountered"))))

x-pack/docs/en/watcher/transform/chain.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ the other available transforms. For example, you can combine a
3030
}
3131
},
3232
{
33-
"script" : "return [ error_count : ctx.payload.hits.total.value ]" <3>
33+
"script" : "return [ error_count : ctx.payload.hits.total ]" <3>
3434
}
3535
]
3636
}

0 commit comments

Comments
 (0)