Skip to content

Commit 3ccd8ef

Browse files
authored
[7.9][DOCS] Amends Painless in group_by transform example. (#67350)
1 parent 1545068 commit 3ccd8ef

File tree

1 file changed

+48
-21
lines changed

1 file changed

+48
-21
lines changed

docs/reference/transform/painless-examples.asciidoc

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ POST _transform/_preview
189189
}
190190
},
191191
"aggregations": { <3>
192+
"all": {
193+
"value_count": {
194+
"field": "response.keyword"
195+
}
196+
},
192197
"200": {
193198
"filter": {
194199
"term": {
@@ -227,50 +232,72 @@ documents, then iterates through the values. If an `agent` field contains
227232
contains "Firefox". Finally, in every other case, the value of the field is
228233
returned.
229234
<3> The aggregations object contains filters that narrow down the results to
230-
documents that contains `200`, `404`, or `503` values in the `response` field.
235+
documents that contains `200`, `404`, or `503` values in the `response` field
236+
and an aggregation that counts responses for each agent.
231237
<4> Specifies the destination index of the {transform}.
232238

233-
234239
The API returns the following result:
235240

236241
[source,js]
237242
--------------------------------------------------
238243
{
239244
"preview" : [
240245
{
246+
"all" : 4010,
247+
"agent" : "explorer",
248+
"200" : 3674,
249+
"404" : 210,
250+
"503" : 126
251+
},
252+
{
253+
"all" : 5362,
241254
"agent" : "firefox",
242255
"200" : 4931,
243256
"404" : 259,
244257
"503" : 172
245258
},
246259
{
247-
"agent" : "internet explorer",
248-
"200" : 3674,
249-
"404" : 210,
250-
"503" : 126
251-
},
252-
{
260+
"all" : 4702,
253261
"agent" : "safari",
254262
"200" : 4227,
255263
"404" : 332,
256264
"503" : 143
257265
}
258266
],
259-
"mappings" : {
260-
"properties" : {
261-
"200" : {
262-
"type" : "long"
263-
},
264-
"agent" : {
265-
"type" : "keyword"
266-
},
267-
"404" : {
268-
"type" : "long"
267+
"generated_dest_index" : {
268+
"mappings" : {
269+
"_meta" : {
270+
"_transform" : {
271+
"transform" : "transform-preview",
272+
"version" : {
273+
"created" : "7.9.3"
274+
},
275+
"creation_date_in_millis" : 1610454866455
276+
},
277+
"created_by" : "transform"
269278
},
270-
"503" : {
271-
"type" : "long"
279+
"properties" : {
280+
"all" : {
281+
"type" : "long"
282+
},
283+
"200" : {
284+
"type" : "long"
285+
},
286+
"404" : {
287+
"type" : "long"
288+
},
289+
"503" : {
290+
"type" : "long"
291+
}
272292
}
273-
}
293+
},
294+
"settings" : {
295+
"index" : {
296+
"number_of_shards" : "1",
297+
"auto_expand_replicas" : "0-1"
298+
}
299+
},
300+
"aliases" : { }
274301
}
275302
}
276303
--------------------------------------------------

0 commit comments

Comments
 (0)